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
@LIST = (path="", model=null, opts={}) -> | |
opts.model = model if model | |
Backbone.Collection.extend $.extend opts, | |
parse: ({data}) -> data | |
comparator: (item) -> | |
compare_item(item) | |
url: API path | |
@REVERSE_LIST = (path="", model=null, opts={}) -> | |
list = @LIST(path, model, opts) | |
$.extend list, |
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 | |
# Report on modules that failed to install. | |
# | |
# Look for various "FAIL" messages in the cpanm build.log files. | |
# (FIXME: Explain the difference, and what they mean.) | |
# Parse out the module names and report any that are not installed. | |
logs=$HOME/.cpanm/work/*/build.log |
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 | |
function stacktrace() { | |
frame=0 | |
while caller $frame ; do frame=$((frame + 1)) ; done | |
} | |
function lib_inner() { | |
stacktrace | |
} |
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
# Set up ssh-agent | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initializing new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null | |
/usr/bin/ssh-add; |
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
altscreen on | |
termcap * OP |
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 | |
# Only split on newlines, so each line of data is one record. | |
default_IFS=$IFS | |
IFS="$(echo -e "\n\r")" | |
# each $line will be one line, even if there are spaces in it. | |
for line in $(cat sample_data.txt) ; do | |
# do stuff... | |
done |
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
-module(pubsub). | |
-export([handle/0, server/0]). | |
server() -> | |
register(ps, handle()). | |
%% handle/0 | |
handle() -> | |
spawn(fun () -> handle([]) end). |
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
-module(hello_world). | |
-behaviour(spooky). | |
-export([init/1, get/2, loop/1]). | |
init([])-> | |
%% register a process that holds our dict in memory | |
case whereis(store) of | |
undefined -> | |
Pid = spawn(?MODULE, loop, [dict:new()]), | |
register(store, Pid), |
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 | |
# Interactive wizard to walk the user through a process. | |
# Tracks steps completed; allows user to exit at any point and pick back up there. | |
function step1 () { | |
read -p "step 1 ok, $1? " ok | |
} | |
function step2 () { |
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 | |
# Update current SVN directory, creating diff & log files from previous version. | |
# For seeing what the rest of your team did. | |
last_rev=$(svn info | grep "^Revision: ") | |
last_rev=${last_rev#Revision: } | |
echo "Updating from $last_rev..." | |
svn up |