Skip to content

Instantly share code, notes, and snippets.

@jnewland
jnewland / .caprc
Created August 21, 2010 17:44
toss this in your ~/.caprc, then `cap cowboy staging deploy`. Use carefully.
namespace :cowboy do
desc 'Deploy without SCM'
task :default do
deploy_stage = fetch(:stage, 'none')
set :repository, "."
set :deploy_via, :copy
set :scm, :none
set :stage, deploy_stage
set :cowboy_deploy, true
set :copy_exclude, [".git/*", ".svn/*", "log/*", "vendor/bundle/*"]
var sys = require('sys'),
spawn = require('child_process').spawn,
http = require('http');
http.createServer(function (req, res) {
var ffmpeg = spawn('ffmpeg', ['-i /path/to/file', '-f mp3', '-']);
res.writeHead(200, {'Content-Type': 'audio/mpeg'});
ffmpeg.stdout.addListener('data', function (d) {
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

module Rack
class NoIE
def initialize(app, options = {})
@app = app
@options = options
@options[:redirect] ||= 'http://www.microsoft.com/windows/internet-explorer/default.aspx'
@options[:minimum] ||= 7.0
end
def call(env)
# Temporary middleware for your APIs to immediately support a /v1/some/path.json prefix to
# all route calls.
#
# When you decide to freeze a current API and provide a /v2/ route then
# you will cease using this middleware and implement /v1/ and /v2/ routing as appropriate
# to your app.
#
# This middleware provides a placeholder until then so users can be told to use /v1/some/path routes
# immediately.
#