Skip to content

Instantly share code, notes, and snippets.

module FakewebHelpers
# Make sure nothing gets out (IMPORTANT)
FakeWeb.allow_net_connect = false
# Turns a fixture file name into a full path
def fixture_file(filename)
return '' if filename == ''
File.expand_path(Rails.root.to_s + '/features/fixtures/' + filename)
end
Run this to host refinery-0.9.7.13 on Heroku
# 1. Basic installation
rvm use 1.8.7-p174@refinery2 --create
gem install bundler
gem install refinerycms
# 2. Run refinerycms. Ensure postgres has started
refinerycms refineroku --database=postgresql
# Step one, check out code from http://code.google.com/p/google-rfc-2445/
# Step two, build the code: ant
# Step three, run this code with jruby
require 'jruby'
require "jars/rfc2445"
java_import "org.joda.time.LocalDate"
java_import "com.google.ical.compat.jodatime.LocalDateIteratorFactory"
@mchung
mchung / Gemfile-rails-2.3.8.rb
Created May 27, 2010 21:20
Rails! Featuring Bundler, Cucumber, RVM, Postgres, on Ruby-1.8.7
# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
google.pacman ||
function () {
var a = true,
e = false,
g = {},
i = [1, 4, 2, 8],
l = {
0: {
axis: 0,
increment: 0
public class MemoryHandler {
public MemoryHandler() {
try {
// Do something crazy
} catch (OutOfMemoryError err) {
System.gc();
}
}
require 'culerity'
$env_javascript_tag = ENV['CULERITY_JAVASCRIPT_TAG'] || '@javascript'
def set_jruby_env
rvm_jruby = ENV['CULERITY_RVM_JRUBY'] || 'jruby'
info = `rvm info #{rvm_jruby}`
gem_home = info =~ /GEM_HOME:\s?"([^"]*)"/ ? $1 : ''
gem_path = info =~ /GEM_PATH:\s?"([^"]*)"/ ? $1 : ''
my_ruby_home = info =~ /MY_RUBY_HOME:\s?"([^"]*)"/ ? $1 : ''
require 'rubygems'
require 'parse_tree'
require 'parse_tree_extensions'
require 'ruby2ruby'
require 'spec'
def code_for_a_proc(proc)
proc.to_ruby
end

Setting up Capybara (w/ @culerity support) using rvm

The following steps will setup ruby 1.8.7-p174 as well as the gems required for Capybara and Culerity support. It will also install Celerity using macports-managed JRuby. Note: sudo is not used.

Steps: $ rvm install 1.8.7-p174 $ rvm 1.8.7-p174 $ gem install rails cucumber capybara webrat rspec cucumber-rails email_spec database_cleaner rspec-rails factory_girl clearance formtastic sqlite3-ruby pg thin mongrel paperclip will_paginate ZenTest autotest-rails culerity $ rvm jruby-1.4.0 $ gem install celerity

@mchung
mchung / lp.rb
Created December 18, 2009 23:58
require 'rubygems'
require 'restclient'
require 'pp'
require 'json'
res = RestClient::Resource.new("https://app.liquidplanner.com/api", "[email protected]", "foo")
# res["workspaces/5551212"].get(:accept => 'application/json')
pp JSON.load res["account"].get(:accept => 'application/json')