Skip to content

Instantly share code, notes, and snippets.

View bradleypriest's full-sized avatar

Bradley Priest bradleypriest

View GitHub Profile
@bradleypriest
bradleypriest / solarized (dark) theme.css
Created November 14, 2011 21:56
JSONView Solarized (Dark) theme
body {
white-space: pre;
font-family: monospace;
font-family: inconsolata;
background: #042029;
color: #819090;
}
.property {
font-weight: normal;
@bradleypriest
bradleypriest / assets.rake
Created September 21, 2011 08:49
Monkey-Patch rake assets:precompile to get Devise to work with Heroku
Rake::Task['assets:precompile'].clear
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"
@bradleypriest
bradleypriest / arel_scopes.rb
Created September 18, 2011 08:27
Arel Scopes
module ArelScopes
extend ActiveSupport::Concern
module ClassMethods
# Create chainable arel scopes
# Example:
# class Post
# arel_scope :published, lambda { arel_table[:published_at].gteq(Time.now) }
# arel_scope :written_by, lambda { |user| arel_table[:author_id].eq(user.id) }