Skip to content

Instantly share code, notes, and snippets.

View alejo4373's full-sized avatar

Alejandro Franco alejo4373

View GitHub Profile
@alejo4373
alejo4373 / css-box-model-notes.md
Last active April 13, 2021 02:44
Notes from the CSS Box Model review session

The CSS Box Model

The CSS box model is the idea that all elements in HTML are boxes and each box has border. Each box/element then has a content area, padding area, border area and margin area. By default the content area will be as wide and as tall as the contents inside the element, and the padding, border and margins are 0 or the browser's defaults, which vary from browser to browser.

Key css box model properties

  • width
  • height
  • padding
@alejo4373
alejo4373 / most_used_commands_bash.sh
Created March 10, 2021 18:03
Program to read your zsh history and output the 10 most common commands in it
cat ~/.bash_history | # Read file
awk 'BEGIN { FS=" " } { print $1 }' | # Split file in fields separated by a space and print the 1st field
sort | # Sort each line lexicographically
uniq -c | # Count number of times a line occurs
sort -n -r | # Sort numerically and in reverse order
head # print the head of the output (first 10 lines)
@alejo4373
alejo4373 / most_used_commands_zsh.sh
Created March 10, 2021 17:54
Program to read your zsh history and output the 10 most common commands in it
cat ~/.zsh_history | # Read file
awk 'BEGIN { FS="[; ]" } { print $3}' | # Split file in fiels separated by a ; or a space and print the 3rd field
sort | # Sort each line lexicographically
uniq -c | # Count number of times a line occurs
sort -n -r | # Sort numerically and in reverse order
head # print the head of the output (first 10 lines)
Command Description
pwd print working directory
cd .. go to parent directory (aka up)
cd [folder] go into folder
~ your home folder
ls list files and subfolders in current folder
@alejo4373
alejo4373 / Pair_Whiteboarding_Exercise.md
Created August 19, 2020 23:18
Pair whiteboarding exercise.

Pair Whiteboarding Exercise

Goal

Practice whiteboarding and reinforce best practices according to Interview Rubric

Steps

  1. You were assigned a group A or B. Remember your group.
  2. Go to the Whiteboarding Questions Repo
  3. Each readme here has a name in the format NN@.md where N is a number from 0-9 and @ will be a letter A or B for example the first question of group A is 01A.md
  4. You will be put into breakout rooms with other people in your group to discuss the problems and solutions and for you to ask questions about them.
// let now = new Date()
// console.log(now)
// console.log(now.getTime())
// console.log(now.toString())
// let petesDate = new Date(1993, 11, 28, 2, 20, 00, 100)
// console.log(petesDate.toString())
// console.log(petesDate.toISOString())
const countDownFromN = (n) => {
if (n < 0) {
return
}
console.log('up:', n)
countDownFromN(n - 1)
// console.log('do:', n) // This is weird but its due to the call stack. If you understand why this happens, you understand recursion.
}
// ------------ db/users.js -----------------
const getAll = async (params) => {
try {
const SQL = "SELECT * FROM reviews WHERE film_id = $/film_id/ AND app_id = $/app_id/"
const reviews = await db.any(SQL, params);
return reviews;
} catch (err) {
throw err;
}
}