Skip to content

Instantly share code, notes, and snippets.

View m3talsmith's full-sized avatar

Michael Christenson II m3talsmith

View GitHub Profile
# Very slightly modified version of this solution: http://stackoverflow.com/a/7508407/294449
Rails.application.assets.logger = Logger.new('/dev/null')
class Rails::Rack::Logger
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].match(/\/assets\//)
call_without_quiet_assets(env).tap do
@cloud8421
cloud8421 / gist:1018400
Created June 10, 2011 07:44
Rails 3.1.rc4 temporary fix for production :scss error (replicated in Heroku)

Rails 3.1.rc4

If you find this error in production env:

ActionView::Template::Error (undefined method compress' for :scss:Symbol (in /app/app/assets/stylesheets/application.css))`

You can temporarily comment out the following line in config/environments/production.rb

config.assets.css_compressor = :scss

@thattommyhall
thattommyhall / mongodb upstart.sh
Last active January 12, 2017 22:04
Automatically run --repair if necessary when starting MongoDB via Upstart
limit nofile 20000 20000
kill timeout 300
env MONGO_DATA=/var/lib/mongodb/
env MONGO_LOGS=/var/log/mongodb/
env MONGO_EXE=/usr/bin/mongod
env MONGO_CONF=/etc/mongodb.conf
pre-start script
@masatomo
masatomo / sequence.rb
Created December 6, 2010 18:19
adds a feature to set sequence number to Mongoid::Document
# encoding: utf-8
module Mongoid #:nodoc:
# Include this module to add automatic sequence feature
# usage:
# Class KlassName
# include Mongoid::Document
# include Mongoid::Sequence
# ...
# field :number, :type=>Integer
# sequence :number
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bash_profile
. ~/.bash_profile
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-v0.2.3.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
curl http://npmjs.org/install.sh | sh
@bjjb
bjjb / authentication.rb
Created September 18, 2010 21:24
Authlogic extensions in a Rails3 app for HTTP token authentication and deprecation removal - put in config/initializers.
module Authlogic
module Session
# Lets you log in using a HTTP token, using the single_access_token.
# Behaves similarly to Params, but with HTTP, so it's nice for APIs.
module HttpToken
def self.included(klass)
klass.class_eval do
extend Config
include InstanceMethods
persist :persist_by_http_token
@nickmerwin
nickmerwin / backup.rake
Created October 8, 2009 20:38
Task to backup your heroku db to S3
# Heroku S3 Database backup task
# by Nick Merwin (Lemur Heavy Industries) 10.08.09
# * dumps db to yaml, gzip's and sends to S3
#
# Setup:
# 1) replace APP_NAME and BACKUP_BUCKET with your info
# 2) add config/s3.yml like so (same as Paperclip's):
# production:
# access_key_id: ...
# secret_access_key: ...