Skip to content

Instantly share code, notes, and snippets.

View hone's full-sized avatar

Terence Lee hone

View GitHub Profile
namespace :assets do
desc "Compile all the assets named in config.assets.precompile"
task :precompile do
# We need to do this dance because RAILS_GROUPS is used
# too early in the boot process and changing here is already too late.
if ENV["RAILS_GROUPS"].to_s.empty? || ENV["RAILS_ENV"].to_s.empty?
ENV["RAILS_GROUPS"] ||= "assets"
ENV["RAILS_ENV"] ||= "production"
Kernel.exec $0, *ARGV
else
@hone
hone / gist:1228013
Created September 20, 2011 00:38
Bundler 1.2 Roadmap
1. Remove Index#use
2. Separate Definition/DSL concerns
3. Move Source#run_hooks into RubyGemsIntegration
4. bundle issues command (posts a gist of the stuff in ISSUES)
5. Get specs passing on JRuby and RBX
6. ruby version check
7. git clone --shallow 1 in bundler, during autoclean mode
8. allow git/path for the same gem: http://www.cowboycoded.com/2010/08/10/using-2-sources-for-a-gem-in-different-environments-with-bundler/
@hone
hone / gist:1228009
Created September 20, 2011 00:36
Bundle Install Flow Path
bundle install
CLI#install
Bundler.root
SharedHelpers#default_gemfile
Bundler.definition
Bundler.default_gemfile
Bundler.default_lockfile
Definition.build
DSL.evaluate
Definition.new
@hone
hone / database.yml.erb
Created September 9, 2011 19:44
heroku cedar erb database.yml
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end
Rails31App::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
source 'http://rubygems.org'
gem 'rails', :git => 'git://github.com/rails/rails.git', :ref => '346cd04704c78a2b0c2b676dcb41f87e0ea6ea2a'
group :assets do
gem 'coffee-rails', '~> 3.1.0.rc'
end
class RegenerateRuntimeDependenciesList < ActiveRecord::Migration
def self.up
Dependency.find_each(:batch_size => 5000) do |dep|
$redis.del(Dependency.runtime_key(dep.version.full_name)) if dep.version
dep.save
end
end
def self.down
end
@hone
hone / newrelic.yml
Created June 1, 2011 19:15
New Relic config for Cedar
---
<%= ENV["RAILS_ENV"] %>:
error_collector:
capture_source: true
enabled: true
ignore_errors: ActionController::RoutingError
apdex_t: 0.5
ssl: false
monitor_mode: true
license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %>
/home/hone/Projects/heroku_work/bundler/lib/bundler/lazy_specification.rb:66:in `method_missing': undefined method `fetch_platform' for rake (0.8.7):Bundler::LazySpecification (NoMethodError)
from /home/hone/Projects/heroku_work/bundler/lib/bundler/source.rb:237:in `download_gem_from_uri'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/source.rb:76:in `fetch'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/installer.rb:55:in `block in run'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/spec_set.rb:12:in `block in each'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/spec_set.rb:12:in `each'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/spec_set.rb:12:in `each'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/installer.rb:54:in `run'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/installer.rb:12:in `install'
from /home/hone/Projects/heroku_work/bundler/lib/bundler/cli.rb:211
@hone
hone / things.rb
Created April 21, 2011 23:11 — forked from wuputah/things.rb
things = Thing.order("id DESC").limit(100)
while things.any?
things.each do |thing|
# stuff
end
things = Thing.order("id DESC").limit(100).where(["id < ?", things.last.id])
end