Skip to content

Instantly share code, notes, and snippets.

Philippe Creux pcreux

Block or report user

Report or block pcreux

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pcreux
pcreux / postgresql.conf
Last active Aug 29, 2015
Speed up Rails test suite!
View postgresql.conf
fsync = off
synchronous_commit = off
full_page_writes = off
@pcreux
pcreux / import-sepa-mandates-to-ca.rb
Last active Aug 29, 2015
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'
View size.rb
class Size
include Comparable
def initialize(str)
unless ALL_STRS.include? str
raise ArgumentError, "#{str} is not a valid size"
end
@str = str
end
@pcreux
pcreux / this-week-in-rails-sample
Last active Aug 29, 2015
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](https://github.com/rails/rails).
@pcreux
pcreux / dependencies.rb
Last active Aug 29, 2015
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/"
View chpwd_update_git_vars.sh
update_current_git_vars
View basecamp-time-report-prettyprint.rb
#!/usr/bin/env ruby
require 'csv'
require 'date'
CSV::Reader.parse(File.open(ARGV[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}"
end
@pcreux
pcreux / migrate_rubygems_to_ruby_enterprise_edition.rb
Created Feb 12, 2010
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
#!/usr/bin/ruby
# 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
pcreux / runner.rb
Created May 20, 2010
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)
end
let(attribute) { instance_variable_get("@#{attribute}") }
end
You can’t perform that action at this time.