Skip to content

Instantly share code, notes, and snippets.

View maximiliano's full-sized avatar

Maximiliano Guerra de Medeiros maximiliano

View GitHub Profile
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

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:

@sdsykes
sdsykes / gist:1047422
Created June 26, 2011 09:04
OSX 10.6.7 python upgrade twisted fails
$ sudo easy_install --upgrade twisted
Password:
install_dir /Library/Python/2.6/site-packages/
Searching for twisted
Reading http://pypi.python.org/simple/twisted/
Reading http://twistedmatrix.com/
Reading http://tmrc.mit.edu/mirror/twisted/Twisted/10.0/
Reading http://www.twistedmatrix.com
Reading http://twistedmatrix.com/products/download
Reading http://tmrc.mit.edu/mirror/twisted/Twisted/8.2/
@tmc
tmc / gist:828553
Created February 15, 2011 23:56
fixed up backbone example
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Backbone example</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="backbone.js"></script>
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&amp;')
.replace(/>/g,'&gt;')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@rbranson
rbranson / run-node.sh
Created October 21, 2010 16:16
start-stop-daemon friendly script to start node and log to a file
#!/bin/sh
#
# Runs node.js against script, logging to a logfile. We have to do
# this because there's no way to call node directly and have start-stop-daemon
# redirect stdout to a logfile.
#
LOGFILE=/var/log/node/node-application.log
NODE=/usr/local/bin/node
JAVASCRIPT=/var/apps/node-application/app.js