Skip to content

Instantly share code, notes, and snippets.

View chrisrzhou's full-sized avatar
⌨️
clicking; clacking;

Chris Zhou chrisrzhou

⌨️
clicking; clacking;
View GitHub Profile
@chrisrzhou
chrisrzhou / README.md
Last active August 29, 2015 14:15
Dances with Factors (Tutorial)

Dances with Factors (Tutorial)

a D3 picture produced by chrisrzhou

[Interactive Project Link][]

![image-180][]


@chrisrzhou
chrisrzhou / README.md
Last active April 26, 2019 06:22
D3 Inflation Explorer

D3 Inflation Explorer

bl.ocks.org link

![image-inflation][]

Explores inflation by visualizing relative prices in two different years.

Mouseover to view details on relative CPI and prices. Click on a tile to freeze details. 2015 years are highlighted in gold.

The project is created using D3.js.

@chrisrzhou
chrisrzhou / bootstrap.md
Last active August 29, 2015 14:19
Frontend Best Practices

Bootstrap Best Practices

General

  • Only style what you need. Create classes or IDs to allow targeting of specific elements.

Containers

  • Use container to create padding and margins that center based on screen width.
  • Use container-fluid to allow for expansion to the whole screen width while keeping a natural padding.
@chrisrzhou
chrisrzhou / git-advanced.md
Last active August 29, 2015 14:19
Git Resources

Git Advanced Resources

Interactive Rebase

  • Enter interactive rebase using git rebase -i
  • Some rebase options include:
    • squash: combine commits
    • edit: split commits (using git reset HEAD^)
    • reword: rename commit
    • pick: run commits in order
@chrisrzhou
chrisrzhou / interview.md
Last active November 13, 2016 04:38
swe_interview_questions

onlyOne

Write a function that returns true or false if exactly one of its parameter is true.

const a = true;
const b = false;
const c = false;
...
onlyOne(a, b, b);  // true
onlyOne(a, b, b, b); // true
@chrisrzhou
chrisrzhou / closure.md
Last active November 14, 2016 07:12
closure and module examples in JS (from https://github.com/getify/You-Dont-Know-JS)

Closure

// no closure
for (var i=1; i<=5; i++) {
  setTimeout(() => {
    console.log(i);  // 6, 6, 6, 6, 6
  }, i*1000);
}
@chrisrzhou
chrisrzhou / patterns.js
Created August 10, 2017 17:58
Flow + React patterns
// basics
type TSimpleType = {
// prefer to name flow types with 'T*' syntax
stringProp: string,
nullableStringProp: ?string,
optionalStringProp?: string,
optionalAndNullableStringProp?: ?string,
type: 'a' | 'b' | 'c',
};
@chrisrzhou
chrisrzhou / react-libraries.md
Last active September 5, 2017 20:11
Useful/quality react libraries

Core Libraries in React Applications

  • react
  • react-redux
  • react-router
  • recompose
  • redux
  • react devtools (chrome)
  • redux devtools (chrome)

Cryptography Notes

Stanford Class: Crypto I

What is Cryptography

  • Central Theorem: Anything that can be done with a trusted authority can also be done without.
    • Instead of passing inputs x1, x2, ..., xn to some Authority object, which then outputs the result f(x1, x2, ..., xn), the inputs themselves can talk to each other and output the same result f(x1, x2, ..., xn)
  • Crypto Magic
    • Privately outsourcing computation: e.g. Google can compute encrypted results E[result] of an encrypted query E[query] without every knowing the contents of query itself.
    • Zero knowledge (proof of knowledge): It is provable that you can give the solution of any puzzle to another person without giving the details of the solution itself. WTF???
  • Cryptography is a rigorous science with 3 key steps: