This file contains hidden or 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/sh | |
greeting="What's up" | |
# notice `EOF` is not quoted | |
cat << EOF | |
No quotes mean I do var substitution: | |
$greeting | |
EOF |
This file contains hidden or 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/sh | |
BASE=$(dirname $0) | |
cd $BASE | |
./bin/mongod \ | |
--noprealloc \ | |
--cpu \ | |
--dbpath $BASE |
This file contains hidden or 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
# fix for broken pbcopy in tmux | |
# see: http://superuser.com/questions/231130/unable-to-use-pbcopy-while-in-tmux-session | |
set-option -g default-command "reattach-to-user-namespace -l bash" | |
unbind C-b | |
set -g prefix C-a | |
# allow mouse navigation (on mac) between panes | |
bind -n M-Left select-pane -L |
This file contains hidden or 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
# | |
# Source, a directory full of files like: t01-open.png, t02-open.png, etc. | |
# Output, rename the files so t01-open.png turns into t00-open.png (start at zero instead of 1) | |
# loop through all the numbers ... | |
for i in {1..20} | |
do | |
# turn 1, 2, 3, 4... into 01, 02, 03, 04 | |
f=$(echo $i | awk '{printf "%02s", $1}') |
This file contains hidden or 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
t01-close.png | |
t01-open.png | |
t01-stroke.png | |
t02-close.png | |
t02-open.png | |
t02-stroke.png | |
t03-close.png | |
t03-open.png | |
t03-stroke.png | |
t04-close.png |
This file contains hidden or 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/sed -f | |
# | |
# turing.sed -- emulate a Turing machine | |
# | |
# Christophe Blaess <[email protected]> | |
# http://perso.club-internet.fr/ccb/ | |
# See text file for information about Turing Machine script. | |
# Read all the instructions, and add a final newline. |
This file contains hidden or 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
Actor = (function() { | |
var my,own,internal,state = 0; | |
return { | |
onMessage: function(msg) { | |
if (msg == "inc") { my = my + 1 } | |
// ... | |
} | |
} |
This file contains hidden or 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
/* | |
Was watching this talk: http://www.youtube.com/watch?v=y4lBEZTThvg | |
about iframes and JS ... so this will create a new iframe, inject new | |
HTML content into it and send it messages through the window.location.hash every second | |
*/ | |
(function() { | |
el = document.getElementById('foo'); | |
iframe = document.createElement('iframe'); | |
iframe.src = "about:blank"; | |
This file contains hidden or 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
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { | |
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; | |
window.cancelAnimationFrame = | |
window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; | |
} | |
if (!window.requestAnimationFrame) window.requestAnimationFrame = function(callback, element) { |
This file contains hidden or 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
bstract class Prize { | |
def * (num: Int): List[Prize] = { | |
if (num == 0) Nil | |
else { | |
import collection.mutable.ListBuffer | |
val l = new ListBuffer[Prize] | |
for (i <- 1 to num) | |
l += this | |
l.toList | |
} |