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
desc "Insert an additional, separate set of fixtures from db/seeds" | |
task :seed_fixtures => :environment do | |
require 'active_record/fixtures' | |
files = "#{Rails.root}/db/seeds/*.yml" | |
connection = ActiveRecord::Base.connection | |
fixtures = Dir[files].collect do |file| | |
extname = File.extname(file) | |
name = File.basename(file).chomp(extname) |
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
namespace :heroku do | |
desc "PostgreSQL database backups from Heroku to Amazon S3" | |
task :backup => :environment do | |
begin | |
require 'right_aws' | |
puts "[#{Time.now}] heroku:backup started" | |
name = "#{ENV['APP_NAME']}-#{Time.now.strftime('%Y-%m-%d-%H%M%S')}.dump" | |
db = ENV['DATABASE_URL'].match(/postgres:\/\/([^:]+):([^@]+)@([^\/]+)\/(.+)/) | |
system "PGPASSWORD=#{db[2]} pg_dump -Fc --username=#{db[1]} --host=#{db[3]} #{db[4]} > tmp/#{name}" | |
s3 = RightAws::S3.new(ENV['s3_access_key_id'], ENV['s3_secret_access_key']) |
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 'faraday' | |
require 'faraday_middleware' | |
url_project = 'https://ciblonet.basecamphq.com' | |
project_id = 3684800 | |
user_name = 'shingara' | |
password = 'xxxx' | |
class Attachment |
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
# concerns#current | |
module Current | |
extend ActiveSupport::Concern | |
... | |
def current_kase | |
@current_kase ||= Kase.find_by_id(params[:kase_id]) | |
end | |
# To include methods in views |
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
curl -v -H 'Accept: application/xml' -F Filedata=@/path/to/file https://trevorturk.basecamphq.com/upload | |
curl -v -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u TOKEN:X \ | |
-d " | |
<post> | |
<title>Test</title> | |
<body>Test</body> | |
<attachments> | |
<file> | |
<file>ID_FROM_FIRST_REQUEST</file> |
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
diff --git a/lib/carrierwave/mount.rb b/lib/carrierwave/mount.rb | |
index 906aaae..be69639 100644 | |
--- a/lib/carrierwave/mount.rb | |
+++ b/lib/carrierwave/mount.rb | |
@@ -226,8 +226,19 @@ module CarrierWave | |
_mounter(:#{column}).write_identifier | |
end | |
- RUBY | |
+ def store_previous_model_for_#{column} |
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
# usage: Given eval "@time = Time.now" | |
Given /^eval "([^"]*)"$/ do |code| | |
eval code | |
end |
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
# config/initializers/email_logger.rb | |
class EmailLogger | |
def self.delivered_email(email) | |
EmailLog.create!( | |
:from => email.from, | |
:to => email.to, | |
:subject => email.subject, | |
:body => email.body.inspect, | |
:date => email.date | |
) |
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
diff --git i/lib/carrierwave/uploader/download.rb w/lib/carrierwave/uploader/download.rb | |
index 123168b..5f39eae 100644 | |
--- i/lib/carrierwave/uploader/download.rb | |
+++ w/lib/carrierwave/uploader/download.rb | |
@@ -13,7 +13,7 @@ module CarrierWave | |
class RemoteFile | |
def initialize(uri) | |
- @uri = URI.parse(URI.escape(uri)) | |
+ @uri = uri |
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/' | |
} | |
export PS1="\w\$(parse_git_branch) > " |