Skip to content

Instantly share code, notes, and snippets.

pcreux / postgresql.conf
Last active August 29, 2015 13:56
Speed up Rails test suite!
View postgresql.conf
fsync = off
synchronous_commit = off
full_page_writes = off
pcreux / import-sepa-mandates-to-ca.rb
Last active August 29, 2015 13:56
Hack to import SEPA mandates from a CSV file to the Crédit Agricole bank. Fun times...
View import-sepa-mandates-to-ca.rb
#encoding: utf-8
# This HACK imports SEPA Mandates from a CSV file to
# Crédit Agricole SEPA System via their HTML API. :)
# Good luck with this!
require 'mechanize'
require 'virtus'
pcreux / this-week-in-rails-sample
Last active August 29, 2015 14:13
Output for latest this week in rails
View this-week-in-rails-sample
layout: post
title: "This week in Rails: 4.2.0 Final, autoload explained, deep_munge and more!"
categories: news
author: chancancode
published: true
date: 2015-01-09 14:04:54 -0800
Welcome to _This week in Rails_, your weekly inside scoop of interesting commits, pull requests and more from [Rails](
pcreux / dependencies.rb
Last active August 29, 2015 14:22
Generate graph of dependency for scss stylesheets
View dependencies.rb
#!/usr/bin/env ruby
# Generate a graph of dependencies for your stylesheets.
# Requires graphviz
# Run `ruby dependencies.rb | fdp -Tpng > out.png; open out.png`
PATH = "app/assets/stylesheets/"
pcreux /
Created November 30, 2009 18:13 — forked from scelis/
Zsh prompt with git status
View basecamp-time-report-prettyprint.rb
#!/usr/bin/env ruby
require 'csv'
require 'date'
CSV::Reader.parse([0])) do |row|
date = row[0].match(/^\d{4}-\d{2}-\d{2}/) ? Date.strptime(row[0], "%Y-%m-%d") : row[0]
hours = row[2]
memo = "#{row[3]} #{row[4]}"
puts "#{date} | #{hours} | #{memo}"
pcreux / migrate_rubygems_to_ruby_enterprise_edition.rb
Created February 12, 2010 22:14
Migrate rubygems to Ruby Enterprise Edition (REE) - Make REE install the gems used by your default ruby environment.
View migrate_rubygems_to_ruby_enterprise_edition.rb
# Migrate rubygems to Ruby Enterprise Edition (REE)
# Make REE install the gems used by your default ruby environment.
REE_PATH = ENV['REE_PATH'] || Dir.glob('/opt/ruby-enterprise-*').last
unless REE_PATH
puts "Can't find path to ruby enterprise edition. Please use the following command:"
puts "REE_PATH=/path/to/ruby-enterprise ruby migrate-rubygems-to-ree"
pcreux / runner.rb
Created May 20, 2010 00:11
script/runner for Rails 3
View runner.rb
#!/usr/bin/env ruby
# script/runner for rails 3.0
APP_PATH = File.expand_path('../../config/environment', __FILE__)
require 'rubygems'
require 'rails/commands/runner'
View rspec-set.rb
require 'rspec'
def set(attribute, &block)
before(:all) do
instance_variable_set("@#{attribute}", yield)
let(attribute) { instance_variable_get("@#{attribute}") }
View rspec-set.rb
# Set @@variable_name in a before(:all) block and give access to it
# via let(:variable_name)
# Example:
# describe Transaction do
# set(:transaction) { Factory(:transaction) }
# it "should be in progress" do
# transaction.state.should == 'in_progress'
# end