Skip to content

Instantly share code, notes, and snippets.

View timruffles's full-sized avatar

Tim Ruffles timruffles

View GitHub Profile
@tvcutsem
tvcutsem / deferredtest.html
Created June 22, 2011 18:08
Deferred functions in Javascript using Generators
<!DOCTYPE html>
<html>
<head>
<!-- using Kris Kowal's Q library, based on CommonJS Promises/B
https://github.com/kriskowal/q
http://wiki.commonjs.org/wiki/Promises/B
Code based on ideas by Mark S. Miller and Dave Herman. The animation example
was taken from <http://wiki.ecmascript.org/doku.php?id=strawman:deferred_functions>
-->
@threetee
threetee / unicorn_wrapper.sh
Created January 20, 2012 19:52
Wrapper to allow runit to send signals to the unicorn master even when its PID changes
#!/bin/sh
set -e
APP=$1
APP_PATH="/srv/${APP}/current"
RAILS_ENV=$2
UNICORN_CONFIG="/etc/unicorn/${APP}.rb"
UNICORN_PID_FILE="/tmp/unicorn.${APP}.pid"
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@alco
alco / gist:2165064
Created March 22, 2012 22:20
Count the number of non-blank SLOC in an Elixir project
git ls-files | egrep '\.erl|\.ex[s]$' | xargs cat | sed '/^$/d' | wc -l
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@banaslee
banaslee / XGH - en.txt
Last active May 3, 2024 14:47
eXtreme Go-Horse Process
eXtreme Go Horse (XGH) Process
Source: http://gohorseprocess.wordpress.com
1. I think therefore it's not XGH.
In XGH you don't think, you do the first thing that comes to your mind. There's not a second option as the first one is faster.
2. There are 3 ways of solving a problem: the right way, the wrong way and the XGH way which is exactly like the wrong one but faster.
XGH is faster than any development process you know (see Axiom 14).
@dominictarr
dominictarr / CYPHERLINK.md
Last active April 24, 2024 16:17
Cypherlinks
defmodule Beamie.Store.RiakHTTP do
def put(bucket, key, value) do
IO.puts "storing value #{inspect value} with key #{key} in bucket '#{bucket}'"
put_req(bucket, key, value)
end
def get(bucket, key) do
IO.puts "retrieving value for key #{key} from bucket '#{bucket}'"
get_req(bucket, key)
end
@dscape
dscape / books.txt
Last active August 29, 2015 14:04
Books for the YLD Office
Predictably Irrational: The Hidden Forces that Shape Our Decisions
Quiet: The power of introverts in a world that can't stop talking
Business Adventures
Zero to One
Beyond Budgeting
Winning Decisions: Getting It Right the First Time
Creativity Inc
Good to Great
Surviving & Thriving in a Relationship with an Entrepreneur
First, Break All the Rules
@anaisbetts
anaisbetts / analytics.js
Created January 7, 2015 20:47
Google Analytics in Atom Shell
// Pretend that cookies work
(function (document) {
var cookies = {};
document.__defineGetter__('cookie', function () {
var output = [];
for (var cookieName in cookies) {
output.push(cookieName + "=" + cookies[cookieName]);
}
return output.join(";");
});