Skip to content

Instantly share code, notes, and snippets.

View krfong916's full-sized avatar
🦁
Organizing for a brighter future

Kyle Fong krfong916

🦁
Organizing for a brighter future
  • University of California, Santa Cruz
View GitHub Profile
@krfong916
krfong916 / git-commands.md
Last active January 12, 2020 12:09
Git commands

Change remote url

git remote set-url origin new.git.url/here

Migrating code to new repo

  • Create github repo
  • git remote set-url origin new.git.url/here
  • git init in repo to migrate
  • Prune/Cleanup the local references to remote branch
    • show branches to prune: git remote prune origin --dry-run
  • prune all branches: git remote prune origin

The Fundamentals

box-shadows

  • Soft inset: box-shadow: inset 0 2px 4px 0 hsla(0,0%,0%,.2)
  • Transparent: box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.1)
  • Soft shadow 1: box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
  • Soft shadow 2: box-shadow: 0 5px 15px 0 hsla(0,0%,0%,0.15)

position basics

  • By default, all elements are position:static. This means the element will be positioned according to the order in the HTML structure.
@krfong916
krfong916 / custom-fns.js
Created January 22, 2020 00:50
A list of all the custom util functions I've created
function callAll(...functions) {
return function(...args) {
functions.forEach(function(fn) {
fn(...args)
})
}
}
function pluck(property, obj) {
return Object.keys(obj).reduce((temp, key) => {

Testing

This document contains notes, insight, and heuristics for the function of tests in engineering and the domain of software. I'm continually editing this document, so information will be out of place, unorganized.

The role of test can be described in many ways, here are a few that I find important:

  • Tests should give a deeper understanding of the code's design
  • Tests should be behavior-driven, and not implementation-driven

What Do We Gain?

React Under The Hood

This file contains notes summarizing the article "React as a UI runtime" by Dan Abramov.

Central concepts

  • React renders a tree of nodes. The kind of tree depends on the host environment
  • Kinds of trees: web/DOM nodes, iOS/iOS hierarchy

Reconciliation

class GetReportsByOrganizationUseCase {
private int userOrganization;
private int requestedOrganization;
private ArrayList<Reports> result = new ArrayList<>();
constructor(userOrganization, requestedOrganization) {
this.userOrganization = userOrganization;
this.requestedOrganization = requestedOrganization;
}
let saveUser = async function(){
let err, user;
[err, user] = await to(UserModel.findById(1));
if(err) throwError(err.message, true);
user.name = “this rocks”
[err, user] = await to(user.save());

Password Encryption

  • do not store cleartext
  • encrypt password with proven cryptographic hash algorithms
  • add salt to protect hashed password from rainbow attacks
  • iterations of processing = salt rounds, improves randomness

What is Salt

Salting is the application of a hash function to a sequence of bits in order to randomize that sequence of bits.