Instantly share code, notes, and snippets.

View safari-reaper.html
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
body {
View Google Chrome Incognito.applescript
if application "Google Chrome" is running then
tell application "Google Chrome" to make new window with properties {mode:"incognito"}
do shell script "open -a /Applications/Google\\ --args --incognito"
end if
tell application "Google Chrome" to activate
View ie67891011-css-hacks.txt
IE6 Only
_selector {...}
IE6 & IE7
*html or { _property: }
IE7 Only
View leak.js
function subject(...args) {
let callback
const queue = []
const iter = thread()
let running = true
return {
send(event) {
if (callback)

async/await with ES6 Generators & Promises

This vanilla ES6 function async allows code to yield (i.e. await) the asynchronous result of any Promise within. The usage is almost identical to ES7's async/await keywords.

async/await control flow is promising because it allows the programmer to reason linearly about complex asynchronous code. It also has the benefit of unifying traditionally disparate synchronous and asynchronous error handling code into one try/catch block.

This is expository code for the purpose of learning ES6. It is not 100% robust. If you want to use this style of code in the real world you might want to explore a well-tested library like co, task.js or use async/await with Babel. Also take a look at the official async/await draft section on desugaring.


  • node.js - 4.3.2+ (maybe earlier with

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both requires a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
View git-proxy.txt
gang@debian:~$ sudo apt-get install netcat-openbsd
gang@debian:~$ cat /usr/local/bin/git-proxy-wrapper
nc -xlocalhost:1080 -X5 $*
gang@debian:~$ export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy-wrapper