Skip to content

Instantly share code, notes, and snippets.

View tennisonchan's full-sized avatar

Tennison Chan tennisonchan

  • Truewind
  • San Francisco
View GitHub Profile
@tennisonchan
tennisonchan / tmux-cheatsheet.markdown
Created June 17, 2019 21:11 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tennisonchan
tennisonchan / System Design.md
Created October 9, 2018 16:10 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@tennisonchan
tennisonchan / tensorflow_json.py
Created April 7, 2018 05:14 — forked from dmmiller612/tensorflow_json.py
Tensorflow Graph and weights to json and back for training
import tensorflow as tf
import numpy as np
from google.protobuf import json_format
import json
np.random.seed(12345)
def tensorflow_get_weights():
"""
@tennisonchan
tennisonchan / AIA003_tf_estimators.ipynb
Created March 10, 2018 22:41 — forked from yufengg/AIA003_tf_estimators.ipynb
Jupyter notebook for AI Adventures episode 3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tennisonchan
tennisonchan / exclude.sql
Created February 23, 2017 14:52 — forked from fphilipe/exclude.sql
PostgreSQL EXCLUDE constraint
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
@tennisonchan
tennisonchan / ember-serviceworker.md
Created October 12, 2016 15:55 — forked from addyosmani/ember-serviceworker.md
Ember Service Worker support

Ember.js currently doesn't have baked in support for Service Worker. They want this and there's an ember-cli RFCS thread discussing strategies however a number of tooling efforts exist to help fill in this gap today.

Note: you can of course just write vanilla Service Worker code for your Ember.js apps and that will work just fine. This doc tracks tooling and libraries that lower the friction for getting this setup

Service Worker Libraries

These static resource precaching and runtime caching libraries are lower-level than Broccoli, but can be used directly

@tennisonchan
tennisonchan / getSelectionString.js
Last active September 19, 2016 11:46 — forked from kangax/gist:05c89595c0d02b3d49bf
get selection string #js
function getSelectionString(el, win) {
win = win || window;
var doc = win.document, sel, range, prevRange, selString;
if (win.getSelection && doc.createRange) {
sel = win.getSelection();
if (sel.rangeCount) {
prevRange = sel.getRangeAt(0);
}
range = doc.createRange();
range.selectNodeContents(el);
@tennisonchan
tennisonchan / Dockerfile
Last active August 23, 2016 03:18 — forked from pinglamb/Dockerfile
#rails #docker Deployment #dockerfile
FROM ensogo/passenger-ruby23:0.9.18
MAINTAINER tennison.chan+dockerfile-gist@gmail.com
ENV HOME /root
CMD ["/sbin/my_init"]
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apt-get update
# Upgrade Passenger

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/