Skip to content

Instantly share code, notes, and snippets.

View adamhunter's full-sized avatar

Adam Hunter adamhunter

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.195 0.195 0.195</string>
<key>InsertionPoint</key>
<string>0.902 0.902 0.902</string>
@adamhunter
adamhunter / gist:704010
Created November 17, 2010 20:21
use the full path stupid
{"init terminating in do_boot",{{badmatch,{error,{file_error,"riak11172010.bak",enoent}}},[{riak_kv_backup,restore,2},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}}
test: &test
bin_dir: /usr/local/riak/bin/
temp_dir: /Users/username/Projects/project/tmp/riaktest
cucumber:
<<: *test
@adamhunter
adamhunter / autoclean.js
Created December 2, 2010 13:38
these are js autocleaners for attributes we'll be validating with a regexp server side
/* autocleaning attributes */
var cleaner = {};
cleaner.phone = function(){
var regex = /[^0-9x]/g;
var value = $(this).val();
if (regex.test(value)) {
$(this).val(value.replace(regex, ''));
}
};
cleaner.date = function(){
#!/bin/sh
set -u
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
APP_ROOT=/home/deploy/public_html/rm/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENV=production
@adamhunter
adamhunter / unicorn.sh
Created December 28, 2010 14:29
init.d file for unicorn with rails 3
#!/bin/sh
set -e
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/deploy/taxscribe/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
CMD="/usr/local/bin/unicorn --config-file $APP_ROOT/config/unicorn.server.rb --env production --daemonize $APP_ROOT/config.ru"
action="$1"
:pages =>[{
:name=>"page-1",
:image=>"/pres/images/filler-image.jpg",
:tooltips=>
[{:tooltip=>"focus-1",
:focusY=>45,
:content=>"Lorem ipsum ",
:placement=>"top-left",
:focusHeight=>23,
:x=>20,
-# where pages = that_example_hash[:pages]
- pages.each do |page|
.image
%img{ :src => "#{page[:image]}" }
-# the x & y coorinants for the top, left corners have some simple logic to subtract 2 from each to counter
-# the 2px border that's added in the CSS. This makes the focus areas overlay the main image in the right spot.
-# pages.each_pair do ||
- page[:tooltips].each do |tooltip|
@adamhunter
adamhunter / riak-backup.sh
Created March 8, 2011 15:20
backup any riak node or cluster without logging onto the server the node is running on (but having riak installed)
/usr/local/riak/erts-5.7.5/bin/erl -noshell -name [email protected] -setcookie riak -eval "riak_kv_backup:backup('[email protected]', \"/path/to/backup-file.riak\", \"all\")" -s init stop
@adamhunter
adamhunter / localstream.erl
Created April 6, 2011 14:35
streaming mapreduce examples with riak local client
-module(localstream).
-export([load/1, keys/0, bucket/0, map/3]).
-define(QUERY, [{map, {modfun, localstream, map}, none, true}]).
load(HowMany) ->
{ok, Client} = riak:local_client(),
lists:foreach(fun(Index) ->
BIndex = list_to_binary(integer_to_list(Index)),