Skip to content

Instantly share code, notes, and snippets.

View jabez128's full-sized avatar

haoran jabez128

View GitHub Profile
@jabez128
jabez128 / imagenet1000_clsid_to_human.txt
Created December 26, 2017 11:49 — 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.)
{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',
@jabez128
jabez128 / gist:eadabe0602d2b4d5f9b2
Created July 6, 2015 18:04
generator mutilple entry
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(pow.next().value); // "first arg"
@jabez128
jabez128 / gulpfile.js
Last active August 29, 2015 14:24 — forked from dbankier/gulpfile.js
// modified from this: https://github.com/emiloberg/nativescript-emulator-reload
// 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?
@jabez128
jabez128 / gist:1dad476e578d0d7f3ad8
Last active August 29, 2015 14:24
use camera api
// 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!
@jabez128
jabez128 / README.md
Last active September 21, 2018 13:42 — forked from boopathi/README.md

Settings

  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
jabez128 / gulpfile.js
Created June 10, 2015 15:39
use babel to write ES6 code now
var gulp = require('gulp')
var sourcemaps = require('gulp-sourcemaps')
var babel = require('gulp-babel')
var concat = require('gulp-concat')
gulp.task('default',function(){
gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('all.js'))
.pipe(babel())
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@jabez128
jabez128 / introrx.md
Last active August 29, 2015 14:18 — forked from staltz/introrx.md

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
jabez128 / index,js
Created June 11, 2014 09:11
use Object.observe to avoid callback hell
/**
* push callback function into arr array
* and observe the arr
* pretty cool!
**/
var request = require('request');
var options = {
url: "http://www.baidu.com"
};
var t1 = new Date();
@jabez128
jabez128 / helloworld.js
Created October 29, 2013 14:08
A hello world gist
console.log('hello world')