Skip to content

Instantly share code, notes, and snippets.

@garth
garth / Jakefile.js
Created December 1, 2011 12:06
Example Jakefile from ViennaJS meetup
// Jake is like Rake for nodejs https://github.com/mde/jake
//
// Assumes that Jake will be run in the root of the web app with coffee files in /js/ and
// a single app.less file in /css/ that can include references to other .less files
//
//requires
var sys = require('util');
var execute = require('child_process').exec;
var fs = require('fs');
Make a keyboard shortcut to run a shell script with Alfred or Quicksilver, and point it at
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
@foca
foca / job.rb
Created July 22, 2011 18:29
I don't really care for running Resque in dev or test environments.
class Job
LAZY_ENVIRONMENTS = %w(development test)
# Add a job to the queue. If we're currently running in any of the
# environments listed in +LAZY_ENVIRONMENTS+ then it automatically performs
# the job.
def self.enqueue(*args)
if LAZY_ENVIRONMENTS.include? Rails.env
Rails.logger.debug "Performing job instead of enqueuing: #{name}"
perform(*args)
@raggi
raggi / eventmachine_is_web_scale.rb
Created September 1, 2010 01:34
the secrets of the web scale sauce
require 'eventmachine'
EM.run do
SEKRET_SAUCE = EM.attach(
open(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 'w')
)
EM.start_server('0.0.0.0', 80, Module.new do
def post_init; proxy_incoming_to(SEKRET_SAUCE); end
end)
end
# Rails example
recipe :ignore
ignore(/(^tmp|jpg|png|gif|css|\.DS_Store)$/)
recipe :rails
process do |files|
Ruby.run_tests(files.take_and_map do |file|
case file