Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# Execute the git, gem, or rake command, depending on the second argument
case ARGV.first
when /^(add|bisect|branch|checkout|clone|commit|diff|fetch|grep|init|log|merge|mv|pull|push|rebase|reset|rm|show|status|tag)$/
system "git #{ARGV.join(' ')}"
when /^(build|cert|check|cleanup|contents|dependency|environment|generate_index|help|install|list|lock|mirror|outdated|pristine|query|rdoc|search|server|sources|specification|stale|uninstall|unpack|update|which)$/
system "gem #{ARGV.join(' ')}"
else
class Array
require 'terminal-table/import'
# Convert an array of instances to an ascii table using the "terminal-table" gem on gemcutter.org
def to_ascii_table(attributes_set = [])
begin
raise "All items must be of the same class, found #{self.collect(&:class).uniq.to_sentence}" if self.collect(&:class).uniq.size != 1
# Get a list of all existing attributes from the list.
if attributes_set.blank?
Rails CMS alternatives
======================
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
"the cutting edge Rails CMS platform"
@tj
tj / gist:266156
Created December 30, 2009 16:17 — forked from neaf/gist:264284
= form :login do
- fieldset :credentials, "Log in" do
- text :username
- text :password
posix.cat('config.json', function(error, config) {
sys.puts(config);
});
var sys = require('sys')
function Queue() {
this.arr = []
}
Queue.prototype.push = function(fn) {
this.arr.push(fn)
}
// this scopes the contents to the current spec
// doesn't matter if callback is fired way later than timeout
it "should work"
var contents
fs.readFile('foo', function(err, c){
contents = c
})
finally
contents.should.eql 'bar'
@tj
tj / server.js
Created August 5, 2010 22:17 — forked from nex3/server.js
var express = require("express");
var app = express.createServer();
app.get("/", function(req, res, next) {
setTimeout(function() {
next(new Error("OH NO"));
}, 10);
});
require.paths.unshift('./support');
require.paths.unshift('./support/connect/lib');
require('proto');
var log = require('./lib/util/log').from(__filename),
Connect = require('connect'),
Express = require('express'),
Assets = require('./lib/assets'),
@tj
tj / out.css
Created February 25, 2011 06:16 — forked from visnup/shadow.sass
header nav {
-webkit-box-shadow: 1px 1px 3px #555;
-moz-box-shadow: 1px 1px 3px #555;
box-shadow: 1px 1px 3px #555;
}