Skip to content

Instantly share code, notes, and snippets.

View steverob's full-sized avatar

Steve Robinson steverob

View GitHub Profile
@steverob
steverob / user.rb
Created March 21, 2014 12:37 — forked from moeffju/user.rb
class User < ActiveRecord::Base
alias :devise_valid_password? :valid_password?
def valid_password?(password)
begin
devise_valid_password?(password)
rescue BCrypt::Errors::InvalidHash
return false unless Digest::SHA1.hexdigest(password) == encrypted_password
logger.info "User #{email} is using the old password hashing method, updating attribute."
self.password = password
@steverob
steverob / deploy.rb
Created March 27, 2014 10:05 — forked from joost/deploy.rb
# encoding: UTF-8
# Place in config/deploy.rb
# See: https://gist.github.com/joost/9343156
# Adapted to work with rbenv
namespace :rails do
desc "Open the rails console on primary app server"
task :console do
on roles(:app), primary: true do
rails_env = fetch(:stage)
execute_interactively "#{bundle_cmd} #{current_path}/script/rails console #{rails_env}"
@steverob
steverob / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
if Rubber::Util.has_asset_pipeline?
# load 'deploy/assets'
_cset :asset_env, "RAILS_GROUPS=assets"
_cset :assets_prefix, "assets"
_cset :assets_role, [:app]
_cset :normalize_asset_timestamps, false
before 'deploy:finalize_update', 'deploy:assets:symlink'
@steverob
steverob / database_yml.config
Last active September 24, 2015 19:24 — forked from t2/sidekiq.config
Sidekiq on AWS ElasticBeanstalk
# Symlink the ondeck database.yml to database.yml.example
# .ebextensions/database_yml.config
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/01a_symlink_database_yml.sh":
mode: "000777"
content: |
#!/bin/bash
cd /var/app/ondeck/config
ln -sf database.sample.yml database.yml