Skip to content

Instantly share code, notes, and snippets.


haoran jabez128

View GitHub Profile
jabez128 / imagenet1000_clsid_to_human.txt
Created Dec 26, 2017 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class id to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
View imagenet1000_clsid_to_human.txt
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
View gist:eadabe0602d2b4d5f9b2
var log = console.log.bind(window.console);
function* powGenerator(){
var result = Math.pow(yield "first arg",yield "sendond arg");
return result;
var pow = powGenerator();
log(; // "first arg"
View gulpfile.js
// modified from this:
// all sources
var babelSrc = [ 'src/**/*.js', '!src/tns_modules', '!src/tns_modules/**', '!src/node_modules', '!src/node_modules/**' ];
var jadeSrc = [ 'src/**/*.jade' ];
var sassSrc = [ 'src/**/*.scss' ];
var resources = [ 'src/{App_Resources,tns_modules,node_modules}/**', 'src/package.json'];
// Which emulator to run?
View gist:1dad476e578d0d7f3ad8
// At first we should write three basic html tag
// include:
// 1) a video tag
// 2) a button
// 3) a canvas tag
// just like below:
// <video id="video" width=600 height=480 autoplay></video>
// <button id="snap">Snap</button>
// <canvas id="canvas" width=600 height=480></canvas>
// prepare work done!


  1. Create a project in XCode with the default settings
    • iOS > Application > Single View Application
    • Language: Swift
  2. Under project General settings, add ReactKit to Linked Framework and Libraries
    • + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
  3. Now ReactKit would have been imported. Link it by choosing it from the list.
    • + > lib.ReactKit.a
  4. Under project Build Settings,
jabez128 / gulpfile.js
Created Jun 10, 2015
use babel to write ES6 code now
View gulpfile.js
var gulp = require('gulp')
var sourcemaps = require('gulp-sourcemaps')
var babel = require('gulp-babel')
var concat = require('gulp-concat')
View ios-8-web-app.html
<!doctype html>
<!-- -->
<title>iOS 8 web app</title>

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

> Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

jabez128 / index,js
Created Jun 11, 2014
use Object.observe to avoid callback hell
View index,js
* push callback function into arr array
* and observe the arr
* pretty cool!
var request = require('request');
var options = {
url: ""
var t1 = new Date();
jabez128 / helloworld.js
Created Oct 29, 2013
A hello world gist
View helloworld.js
console.log('hello world')