Q:
Hi there, I noticed the following:
This query:
AvailabilityUpdate.where(hotel_id: "AT_INN_BINDERS").only(:timestamp).limit(1).entries.first.timestamp
# https://github.com/mhenrixon/sidekiq-unique-jobs/issues/161 | |
# Even worse: https://github.com/mhenrixon/sidekiq-unique-jobs/issues/234 | |
class SidekiqUniqueJobsHashCompactor | |
include Sidekiq::Worker | |
sidekiq_options queue: "slow" | |
def perform | |
# Skip if there are jobs queued... | |
return unless Sidekiq::Queue.all.select { |q| q.size > 100 }.blank? |
# Hook into unicorn, unicorn middleware, not rack middleware | |
# | |
# Since we need no knowledge about the request we can simply | |
# hook unicorn | |
module Middleware::UnicornOobgc | |
MIN_REQUESTS_PER_OOBGC = 5 | |
MAX_DELTAS = 20 |
namespace :jshint do | |
task :require do | |
sh "which jshint" do |ok, res| | |
fail 'Cannot find jshint on $PATH' unless ok | |
end | |
end | |
task :check => 'jshint:require' do | |
project_root = File.expand_path('../../', File.dirname(__FILE__)) | |
config_file = File.join(project_root, 'config', 'jshint.json') |
This runs provides an .optim job for dragonfly and also adds the .optim job into .thumb
This requires you have the 'image_optim' gem and it's dependencies.
$ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
$ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl
$ chmod +x ~/bin/powssl
$ powssl
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
describe PostsController do | |
describe "GET index" do | |
subject { get :index } | |
it { should assign_to(:posts).with(Post.all) } | |
end | |
end |