Skip to content

Instantly share code, notes, and snippets.

View hoverlover's full-sized avatar

Chad Boyd hoverlover

View GitHub Profile
@rsanheim
rsanheim / gist:1054078
Created June 29, 2011 15:23
Devise + Spork + Rails 3.1 RC4 hacks to keep User model from loading prefork
Spork.prefork do
require "rails/application"
# Prevent Devise from loading the User model super early with it's route hacks for Rails 3.1 rc4
# see also: https://github.com/timcharper/spork/wiki/Spork.trap_method-Jujutsu
Spork.trap_method(Rails::Application, :reload_routes!)
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
# rest of your prefork here...
end
@pivotal-casebook
pivotal-casebook / Gemfile
Created July 9, 2011 13:20
Gemfile and spec_helper with Spork
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
@mattsears
mattsears / README.md
Created August 21, 2011 20:01
Diff.rb: CodeBrawl's "Ruby diffs" entry (http://codebrawl.com/contests/ruby-diffs)

Diff.rb

A simple diff utility written in Ruby. It works with single or multi-line strings and returns an array of hashes that indicates the line number affected and change: added, deleted, or same.

Example:

@pcantrell
pcantrell / Gemfile
Created November 29, 2011 17:42
Get app profiling straight from the browser. Usage: (1) http://localhost:3000/rubyprof/start (2) Exercise slow requests (3) http://localhost:3000/rubyprof/stop (be patient) to get a report.
gem 'ruby-prof'
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@panzi
panzi / escapeXml.js
Created February 18, 2012 04:16 — forked from atesgoral/escapeXml.js
Escape XML in JavaScript.
var XML_CHAR_MAP = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'"': '&quot;',
"'": '&apos;'
};
function escapeXml (s) {
return s.replace(/[<>&"']/g, function (ch) {
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@amfeng
amfeng / callback.erb
Last active August 8, 2022 19:33
Stripe OAuth Example -- Ruby
<!doctype html>
<head>
<title>Stripe OAuth Example</title>
</head>
<body>
<%= @access_token %>
</body>
</html>
@dbainbridge
dbainbridge / app.js
Created April 19, 2012 20:48
How to use socket.io with Express 3
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@hoverlover
hoverlover / faking_it_with_savon.rb
Created April 20, 2012 20:09
Faking it with Savon. Returns a fake response instead of hitting the soap service.
require 'spec_helper'
describe "Faking it with Savon" do
before do
Savon.hooks.define "Fake Response", :soap_request do
HTTPI::Response.new(200, {}, "<Envelope><Body><response>Success!</response></Body></Envelope>")
end
after do
Savon.hooks.reject! "Fake Response"