This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
prefork = lambda { | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
} | |
each_run = lambda { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:12.04 | |
RUN apt-get update | |
RUN apt-get install -y --force-yes build-essential curl git | |
RUN apt-get install -y --force-yes zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt-dev | |
ADD http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz /tmp/ruby-2.1.0.tar.gz | |
RUN cd /tmp; \ | |
tar xzf ruby-2.1.0.tar.gz; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
# force the whole app to use its own tmpdir | |
FileUtils.mkdir_p(Rails.root.join('tmp')) | |
ENV['TMPDIR'] = Rails.root.join('tmp') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-load | |
# http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-dump | |
# https://github.com/JEG2/faster_csv/blob/master/test/tc_serialization.rb | |
require 'csv' | |
class Person | |
attr_accessor :id, :name, :email | |
def self.csv_load(meta, headers, row) | |
person = Person.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def donate_to_charity(args = {}) | |
# Set valid options that can be supplied. All others will be cut. | |
valid_args = [:user_id, :charity_id, :amount] | |
# Set default options if none are supplied | |
defaults = { :user_id => nil, | |
:charity_id => 1, | |
:amount => 25 } | |
# Raise ArgumentError if invalid keys are passed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# | |
# Renders Google Analytics tracking script | |
# | |
# Example | |
# | |
# <%= render 'shared/analytics', ua_code: 'UA-XXXXXX-X' %> | |
# | |
#%> | |
<% if Rails.env.production? %> | |
<script type="text/javascript"> |
OlderNewer