Trevor Turk trevorturk

View gist:844117
1 2 3 4 5 6 7 8 9 10
# 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
)
View gist:824561
1 2 3 4 5 6 7 8 9 10
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
View gist:822366
1 2 3 4 5
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
 
export PS1="\w\$(parse_git_branch) > "
View gist:806218
1 2 3 4 5 6 7 8 9 10
$(document).ready(function(){
var focus = true;
var count = 0;
var title = document.title;
 
$(window).focus(function(){
focus = true;
count = 0;
setTimeout(function(){
document.title = title;
View gist:794958
1 2 3 4 5 6 7 8 9 10
# config/initializers/delayed_job.rb
 
Delayed::Worker.destroy_failed_jobs = false
 
class Delayed::Worker
alias_method :original_handle_failed_job, :handle_failed_job
 
def handle_failed_job(job, error)
HoptoadNotifier.notify(error)
original_handle_failed_job(job, error)
View cache_assets.rake
1 2 3 4 5 6 7 8 9
desc "cache assets"
task :cache_assets => :environment do
 
paths = ['public/javascripts/all.js', 'public/stylesheets/all.css']
 
puts "-----> caching assets..."
paths.each do |path|
puts "-----> #{path}"
end
View Rakefile
1 2 3 4 5 6 7 8 9 10
require 'rubygems'
require 'httparty'
 
task :pinboard do
class Pinboard
include HTTParty
base_uri 'https://api.pinboard.in/v1'
 
def initialize(auth)
@auth = auth
View gist:752928
1 2 3 4 5 6 7 8 9 10
# lib/tasks/deploy.rb
 
desc "deploy to heroku and notify hoptoad"
task :deploy => :environment do
puts "deploying to heroku..."
%x[git push heroku master]
puts "notifying hoptoad..."
rev = %x[git log master -n 1 --pretty=format:%H]
%x[rake hoptoad:deploy TO=production REVISION=#{rev}]
puts "done..."
View Gemfile
1 2 3 4 5 6 7 8 9 10
# Gemfile
 
source 'http://rubygems.org'
 
gem 'rails'
 
group :test do
gem 'capybara'
gem 'launchy'
end
View gist:739412
1 2 3 4 5 6 7 8 9 10
def filter_params(params)
params.inject({}) do |acc, (k, v)|
acc[k] = if v.is_a?(Hash)
filter_params(v)
else
v.is_a?(Tempfile) ? '[REMOVED: Tempfile]' : v
end
acc
end
end
Something went wrong with that request. Please try again.