This file contains hidden or 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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| config.vm.box = "hashicorp/precise64" | |
| config.vm.synced_folder "~/workspace/cf_console", "/home/vagrant/workspace/cf_console" |
This file contains hidden or 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
| cd /tmp | |
| git clone git://github.com/rubinius/rubinius.git ruby | |
| cd ruby | |
| git co vX.X.X | |
| bundle | |
| ./configure --prefix=/.rbenv/versions/rbx-2.2.8 | |
| rake | |
| rm -rf ruby | |
| cd - |
This file contains hidden or 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
| ruby -e 'require "yaml"; require "open-uri"; puts YAML.load("---\nfoo: bar\n")["foo"];`open http://foo:[email protected]`' |
This file contains hidden or 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
| ignored_dirs = "--ignore-dir=spec --ignore-dir=log --ignore-dir=tmp --ignore-dir=vendor" | |
| methods = `ack --no-group --no-color #{ignored_dirs} 'def .*'`.split("\n").map { |x| x.split(/\:\s*def\s*(?:self\.)?|\s|\(/)[0..1] } | |
| methods.each do |filename, method| | |
| if `ack --no-group --no-color #{ignored_dirs} -w #{method}`.strip.split("\n").length == 1 | |
| puts "#{filename} #{method}" | |
| end | |
| end |
This file contains hidden or 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 django.db import models | |
| from django.core.exceptions import ValidationError | |
| from django.forms import ModelForm | |
| class CleanModel(models.Model): | |
| """ Abstract class that adds field validations """ | |
| def clean_fields(self, exclude): | |
| errors = {} |
This file contains hidden or 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
| named_scope :report_options, lambda { |params| | |
| { | |
| :include => :order, | |
| :joins => [:order => [:redemption, :promo_code]], | |
| :conditions => | |
| [ | |
| params[:before] ? "redemptions.created_at < '#{params[:before]}'" : nil, | |
| params[:after] ? "redemptions.created_at > '#{params[:after]}'" : nil, | |
| params[:promo_code] ? "promo_codes.token = '#{params[:promo_code]}'" : nil | |
| ].compact.join(" AND ") |
This file contains hidden or 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 log_to(stream) | |
| ActiveRecord::Base.logger = Logger.new(stream) | |
| ActiveRecord::Base.clear_active_connections! | |
| end |