From the Go tour. Only supports trees of size 10 for now.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"os" | |
"strings" | |
) | |
type rot13Reader struct { | |
r io.Reader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Safari" | |
set theWindows to windows | |
set win1 to item 1 of theWindows | |
set win2 to item 2 of theWindows | |
repeat | |
tell win1 | |
set index to 1 | |
set visible to false | |
set visible to true | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Widen Github | |
// @namespace http://use.i.E.your.homepage/ | |
// @version 0.1 | |
// @description enter something useful | |
// @match https://github.com/* | |
// @copyright 2012+, You | |
// ==/UserScript== | |
var containerWidth = $('.container').css('width'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke | |
switch (self ? -1 : args.length) { | |
case 0: return fn(); | |
case 1: return fn(args[0]); | |
case 2: return fn(args[0], args[1]); | |
case 3: return fn(args[0], args[1], args[2]); | |
case 4: return fn(args[0], args[1], args[2], args[3]); | |
case 5: return fn(args[0], args[1], args[2], args[3], args[4]); | |
case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]); | |
case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq free-keys-modifiers (list "C" "M" "C-M")) | |
(setq free-keys-keys "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.,/§1234567890-=[];'\\`±!@#$%^&*()_+}{:\"|?><~") | |
(defun free-keys () | |
(interactive) | |
(let ((buf (get-buffer-create "*Free keys*"))) | |
(display-buffer buf) | |
(with-current-buffer buf | |
(erase-buffer) | |
(mapc (lambda (modifier) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dir="$HOME/Documents/commit-photos" | |
if [[ ! -d $dir ]]; then | |
mkdir -p $dir | |
fi | |
f=`echo \`date "+%Y%m%d-%H%M%S"\`` | |
device=`imagesnap -l | grep -v "Video Devices:" | head -n 1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
UGLIFY=`which uglifyjs` | |
ARGS="--beautify" | |
F1=/tmp/$RANDOM | |
F2=/tmp/$RANDOM | |
cat $1 | $UGLIFY $ARGS > $F1 | |
cat $2 | $UGLIFY $ARGS > $F2 |
NewerOlder