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

Code Reviews

Chris Zhou, 2022-10-14


Elements of Coding

  • Code
  • Coder
@chrisrzhou
chrisrzhou / the-garden-of-code.md
Last active June 24, 2022 20:18
Tending to your code, finding and killing bugs, growing a garden

The Garden of Code

Chris Zhou, 2022-06-24


About

I discovered many of the following thoughts through gardening and they continue to influence the way I think and code.

@chrisrzhou
chrisrzhou / typescript-notes.md
Last active February 26, 2020 00:38
Typescript notes

Main resource: https://basarat.gitbook.io/typescript/

  • Typescript is a superset of Javascript. The type system in Typescript is designed to be optional so that your Javascript is Typescript. It does not block Javascript emit in the presence of type errors, allowing users to progressively update JS to TS.
  • Upgrading to TS without anyone noticing: https://devblogs.microsoft.com/typescript/how-to-upgrade-to-typescript-without-anybody-noticing-part-1/
  • Migrating JS -> TS
    • Add a tsconfig.json.
    • Convert files from .js to .ts. Suppress errors using any.
    • Write new code in TS avoiding using any.
    • Go back to old code and start adding type annotations and fixing bugs.
  • Use ambient definitions for third party JS code.
@chrisrzhou
chrisrzhou / unified-search-spec.md
Last active February 25, 2020 19:09
Unified Search Spec
@chrisrzhou
chrisrzhou / code1.js
Created March 21, 2019 05:52
React Hooks + Threejs
function useResponsiveCanvas<T>(
initialSize?: MinMaxPair,
): State {
const canvasRef = useRef<HTMLCanvasElement>();
const mountRef = useRef<HTMLDivElement>();
const [size, setSize] = useState<MinMaxPair>([0, 0]);
// set initial svg and size
useEffect(() => {
const canvas = document.createElement('canvas');
@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:
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)