Examples
It’s a tool for creating isolated UI components
May be known as:
How it works:
Getting Started
/components
- React components, etc/.storybook
) - npx -p @storybook/cli sb init
npm run storybook
Phonebook tests repo - Test structure: Arrange, act, assert
Phonebook tests repo - add test fixture
Promoted to Senior FED 🎉
Updated python server & updated code on production to use sqlite3
sudo apt-get update
sudo apt-get upgrade
cd /var/www/distantlife.com/html
sudo systemctl stop distantlife
git pull
sudo systemctl start distantlife
A unit test doesn’t use:
DistantLife: change use of cs50
library to sqlite3
for database queries
Was:
from cs50 import SQL
db = SQL("sqlite:///distantlife.db")
Now:
import sqlite3
con = sqlite3.connect("distantlife.db")
con.row_factory = sqlite3.Row # includes column name in return dictionary
db = con.cursor()
Updated:
@app.route("/pets")
@login_required
def pets():
"""Lists all of user's pets"""
- # previously using cs50 db query
- # pets_owned = db.execute("SELECT pets.id, pet_types.imgsrc, pet_types.pet_type, pets.created, pets.exp, pets.name, users.active_pet_id FROM owners JOIN pets ON pets.id = owners.pet_id JOIN pet_types ON pets.type = pet_types.id JOIN users ON users.id = owners.owner_id WHERE owner_id = ?", session_get_int("user_id"))
- # [{'id': 15, 'imgsrc': '/pets/034-jackalope.png', 'pet_type': 'Jackalope', 'created': '2021-12-05 18:04:39', 'exp': 0, 'name': 'Unnamed Pet', 'active_pet_id': 15}]
+ # now, updated using .fetchall and rows magic (above)
+ # also required trailing " , " in list of params
+ pets_owned = db.execute("SELECT pets.id, pet_types.imgsrc, pet_types.pet_type, pets.created, pets.exp, pets.name, users.active_pet_id FROM owners JOIN pets ON pets.id = owners.pet_id JOIN pet_types ON pets.type = pet_types.id JOIN users ON users.id = owners.owner_id WHERE owner_id = ?", (session_get_int("user_id"), )).fetchall()
+ # https://itheo.tech/get-column-names-from-sqlite-with-python
+ # print(dict(pets_owned[0]))
+ # {'id': 15, 'imgsrc': '/pets/034-jackalope.png', 'pet_type': 'Jackalope', 'created': '2021-12-05 18:04:39', 'exp': 0, 'name': 'Unnamed Pet', 'active_pet_id': 15}
return render_template("list.html", pets_owned=pets_owned)
After every UPDATE, INSERT, and DELETE you also need to commit in order to ensure the execution moves from the journal to the database.
Example of updating a row, checking if there was an update with rowcount
and committing the update
updateqry = db.execute(
"UPDATE pets SET exp = ? WHERE id = ?", (exp, active_pet_id))
con.commit()
if (updateqry.rowcount > 0):
session.get("active_pet")["exp"] = exp
return exp
else:
return 0
AWS Cert: Introduction to Security and Architecture on AWS
AWS Cert: Introduction to Security and Architecture on AWS
AWS Cert: Introduction to Security and Architecture on AWS
AWS Cert: Introduction to Security and Architecture on AWS
AWS Cert: Understanding AWS Core Services
AWS Cert: Understanding AWS Core Services
Email: learn and test DMARC (Domain-based Message Authentication, Reporting & Conformance)
AWS Cert: Understanding AWS Core Services
Compute services:
Methods of interacting:
Setting up AWS CLI, download CLI v2
aws configure --profile ps
AWS Access Key ID [None]: KEY_ID
AWS Secret Access Key [None]: SECRET_KEY
Default region name [None]: us-west-2
Default output format [None]: json
Example, list all S3 buckets:
aws s3 ls --profile ps
AWS Cert: Fundamental Cloud Concepts
AWS Cert: Fundamental Cloud Concepts
Learned that this SCSS syntax works for compiling font styles: (thanks LauraBoemo!)
.myclass {
font: {
family: $theme-font-regular;
size: 16px;
weight: 300;
}
}
Ideas for Round 5 starting February 1, 2022