Skip to content

Instantly share code, notes, and snippets.

mrdoob / gist:718743
Last active May 10, 2021
Simplest HTML5 drawing tool
View gist:718743
body {
margin: 0;
padding 0;
tvandervossen / testing.txt
Created Apr 13, 2011
A small part from a code review report for an iOS app
View testing.txt
Automated testing (even though still not widely used by Objective-C developers) would make
refactoring much easier, faster and safer. Good test coverage would also allow maintenance
to be done and new features to be added without first having to fully investigate the
function of all parts of the codebase and the way these parts fit together. This especially
applies when work is contracted out to developers other than those who originally created
the application.
The lack of a comprehensive automated test suite is a real disadvantage. Adding one is
markbates /
Created Aug 31, 2011
Sprockets with a simple Rack app
require 'sprockets'
project_root = File.expand_path(File.dirname(__FILE__))
assets = do |env|
env.logger =
assets.append_path(File.join(project_root, 'app', 'assets'))
assets.append_path(File.join(project_root, 'app', 'assets', 'javascripts'))
assets.append_path(File.join(project_root, 'app', 'assets', 'stylesheets'))
madrobby /
Created Nov 14, 2011
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
sirupsen / explain.rb
Created Dec 6, 2011
.ircrb entry to run explain on a query.
View explain.rb
if defined? ActiveRecord
def explain(query)
query = query.to_sql if query.is_a?(ActiveRecord::Relation)
.execute("EXPLAIN ANALYZE #{query}")
.each { |hash| puts hash["QUERY PLAN"] }
tvandervossen / gist:1478543
Created Dec 14, 2011
Initial client lead questions
View gist:1478543
Can you please answer the following questions so we can assess the project,
and judge if we would be a good match?
1. Is this a new project, or is this for an existing website or application?
- This is a project for a completely new site or application
- This is a project to update an existing site or application
2. Which of the following areas do you need help with?
voodootikigod / migrate.js
Created Jan 3, 2012
Schema (SQL) and Data (JS) Migrations for node.js (specifically PostgreSQL, but could be MySQL)
View migrate.js
#!/usr/bin/env node
// this file is stored in a directory of APP_ROOT/script for me, all things are relative to that
var APP_ROOT = __dirname+"/../";
// this assumes there is a file stored in APP_ROOT called "config.js" with the following structure:
// module.exports = {
// "development: {
// "postgresql": "tcp://postgres@localhost/dev-db"
rstacruz /
Last active Jun 10, 2021
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User


jimbojsb / gist:1630790
Created Jan 18, 2012
Code highlighting for Keynote presentations
View gist:1630790

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

reyjrar / New-iTerm-Window.scpt
Created Feb 8, 2012
AppleScript to Open a New iTerm Window and bring it to the front
View New-iTerm-Window.scpt
* New-iTerm-Window.scpt
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
* Based on much Googling - very little "original" code here
* Comments/Suggestions to