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 / react-threejs-globe.js
Last active May 9, 2018 09:20
react-threejs-globe
//https://codesandbox.io/s/x77p8rrnxo
import React from 'react';
import * as THREE from 'three';
import OrbitControls from 'three-orbitcontrols';
export default class Scene extends React.Component {
static defaultProps = {
radius: 600,
textureURL:
@chrisrzhou
chrisrzhou / README.md
Last active October 19, 2017 09:32
D3 Sunburst Sequence

D3 Sunburst Sequence

bl.ocks.org link

D3 Sunburst Sequence visualizes a graph of nodes by highlighting sequential progression of nodes leading up to a final value. A sunburst sequence is useful to visualize relative weights/percentages of a starting state to an end state (e.g. webpage redirects, product retention, subscription-based products, cashflows).


Description

create-react-app testapp
cd testapp

// dev flow
yarn start

// build flow
yarn build
cd build

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:
@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)
@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 / 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 / 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 / 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 / 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.