Skip to content

Instantly share code, notes, and snippets.

View jamescook's full-sized avatar
🏠
Working from home

James Cook jamescook

🏠
Working from home
View GitHub Profile
class ActiveRecordBase extends Backbone.Model
url: "/"
fields: []
toJSON: () ->
@attributes.authenticity_token = @token()
return _.clone(@attributes)
fill: (selector) ->
form = jQuery(selector)
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
# Compile CityHash
#g++ -shared city.cc -o libcity.dylib
#
# Figure out the symbol names.. this doesn't look right. Probably user error.
# nm -g libcity.dylib
#
=begin
0000000000000db7 T __Z10CityHash64PKcm
0000000000001800 T __Z11CityHash128PKcm
@mackermedia
mackermedia / Gemfile
Last active August 4, 2016 19:07
Capybara + JS Testing
group :test do
gem 'capybara'
gem 'poltergeist' # gem 'capybara-webkit'
gem 'database_cleaner'
end
@kesor
kesor / an upstart unicorn.conf
Last active February 9, 2022 09:20
Unicorn that receives USR2 signal on upstart's "stop unicorn", but also allows upstart to respawn it when for some reason it crashed on its own.
# unicorn
description "unicorn ruby app server"
start on (local-filesystems and net-device-up IFACE=lo and runlevel [2345])
stop on runlevel [!2345]
env WORKDIR=/data
env PIDFILE=/data/tmp/pids/unicorn.pid
env CFGFILE=/data/config/unicorn.rb