Skip to content

Instantly share code, notes, and snippets.

View zjhiphop's full-sized avatar
🎯
Focusing

newboy zjhiphop

🎯
Focusing
  • cloud-tea
  • USA
View GitHub Profile
@zjhiphop
zjhiphop / introrx.md
Last active August 29, 2015 14:23 — 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.

@zjhiphop
zjhiphop / introrx.md
Last active August 29, 2015 14:23 — 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.

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@zjhiphop
zjhiphop / callstack.js
Created November 21, 2014 07:04
callstack.js
/*
* 打印 JavaScript 函数调用堆栈
*/
function printCallStack() {
var i = 0;
var fun = arguments.callee;
do {
fun = fun.arguments.callee.caller;
console.log(++i + ': ' + fun);
} while (fun);
@zjhiphop
zjhiphop / jquery-each-context.js
Last active August 29, 2015 14:09
jquery-each-context issue
function test() {
var a = 1;
$('span').each(function() {
this.innerHTML = a; // 'a' can not accessed in this scope
});
}
@zjhiphop
zjhiphop / uri.js
Last active August 29, 2015 14:07 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@zjhiphop
zjhiphop / programme jokes
Last active August 29, 2015 14:05
programme jokes
def protecter():
sb = []
sb.append(" _ooOoo_\n")
sb.append(" o8888888o\n")
sb.append(" 88\" . \"88\n")
sb.append(" (| -_- |)\n")
sb.append(" O\\ = /O\n")
sb.append(" ____/`---'\\____\n")
sb.append(" .' \\\\| |// `.\n")
sb.append(" / \\\\||| : |||// \\ \n")