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
| require 'find' | |
| namespace :db do | |
| desc "Backup the database to a file. Options: DIR=base_dir RAILS_ENV=production MAX=7 SKIP_DEV=true" | |
| task :backup => [:environment] do | |
| skip = ENV["SKIP_DEV"] || "" | |
| unless(RAILS_ENV == "development" && skip == "") | |
| base_path = ENV["DIR"] || Dir.home |
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
| window.Buffer = | |
| buffer: [] | |
| executing: false | |
| pushToBuffer: (method, callback) -> | |
| Buffer.buffer.push -> | |
| Buffer.executing = true | |
| method (result) -> | |
| callback(result) | |
| Buffer.executeFromBuffer() | |
| Buffer.executeFromBuffer() unless Buffer.executing |
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
| require 'rubygems' | |
| require 'fog' | |
| connection = Fog::Storage.new(:provider => 'AWS') | |
| directory = connection.directories.find{|dir| dir.key == ENV['BUCKET_KEY']} | |
| file = directory.files.last | |
| File.open ENV['BACKUP_FILE'], 'w' do |backup| | |
| backup << file.body | |
| 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
| class User < ActiveRecord::Base | |
| STATUS = { :active => 1, :inactive => 2, :pending => 3, :announce => 4, :curator => 5 } | |
| scope :active, where("status = #{STATUS[:active]}") | |
| scope :inactive, where("status = #{STATUS[:inactive]}") | |
| scope :pending, where("status = #{STATUS[:pending]}") | |
| scope :announce, where("status = #{STATUS[:announce]}") | |
| 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
| class User < ActiveRecord::Base | |
| STATUS = { :active => 1, :inactive => 2, :pending => 3, :announce => 4, :curator => 5 } | |
| def self.active; where(:status => STATUS[:active]); end | |
| def self.inactive; where(:status => STATUS[:inactive]); end | |
| def self.pending; where(:status => STATUS[:pending]); end | |
| def self.announce; where(:status => STATUS[:announce]); 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
| class User < ActiveRecord::Base | |
| STATUS = { :active => 1, :inactive => 2, :pending => 3, :announce => 4, :curator => 5 } | |
| STATUS.each do |k, v| | |
| define_singleton_method(k) do | |
| where(:status => v) | |
| end | |
| 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
| require 'vcr' | |
| ... | |
| VCR.configure do |c| | |
| c.cassette_library_dir = 'spec/cassettes' | |
| c.hook_into :fakeweb | |
| c.configure_rspec_metadata! | |
| end | |
| RSpec.configure do |config| | |
| ... |
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
| describe "group", :vcr do | |
| ... | |
| end | |
| context "other group", :vcr do | |
| ... | |
| 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
| spec/cassettes* |
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
| group :test do | |
| gem 'vcr' | |
| gem 'fakeweb' | |
| end |
OlderNewer