Skip to content

Instantly share code, notes, and snippets.

@swijw
swijw / Git
Created October 27, 2012 10:12
git
1. Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/swchenforgetful/Test.git
git push -u origin master
@swijw
swijw / .gitconfig
Created October 27, 2012 21:23 — forked from dahlbyk/.gitconfig
Windows Git Diff/Merge Tool Configuration
[alias]
dt = difftool
mt = mergetool
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool "p4"]
@swijw
swijw / String.format.js
Created October 29, 2012 04:18
JavaScript String.format
String.format = function(src) {
if (arguments.length) {
return null;
}
var args = Array.prototype.slice.call(arguments, 1);
return src.replace(/\{(\d+)\}/g, function(m, i) {
return args[i];
});
};
@swijw
swijw / repl-client.js
Created October 30, 2012 16:39 — forked from TooTallNate/repl-client.js
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@swijw
swijw / repl-client.js
Created October 30, 2012 16:40 — forked from TooTallNate/repl-client.js
Running a "full-featured" REPL using a net.Server and net.Socket
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)