Skip to content

Instantly share code, notes, and snippets.

View dlackty's full-sized avatar
😇

Richard Lee dlackty

😇
View GitHub Profile
@jcsrb
jcsrb / article_image_uploader.rb
Created December 22, 2011 15:02
CarrierWave extension fix_exif_rotation, strip, quality, resize_to_fill_if_larger
class ArticleImageUploader < ImageUploader
process :fix_exif_rotation
process :strip
process :convert => 'jpg'
process :quality => 85 # Percentage from 0 - 100
version :gallery_thumb do
process :resize_to_fill => Settings.images.article_images.processing.gallery_thumb #44x44
end
@hoverlover
hoverlover / active_admin_heroku.rb
Created June 7, 2011 16:35
Rails initializer for using ActiveAdmin with Sass on Heroku
if Rails.env.production?
require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets", "admin"))
template_path_one = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/app/assets/stylesheets"
template_path_two = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/lib/active_admin/sass"
old_compile_path = "#{Rails.root}/public/stylesheets/admin"
new_compile_path = "#{Rails.root}/tmp/stylesheets/admin"
Sass::Plugin::remove_template_location template_path_one
@jmahowald
jmahowald / rvmbootsrap
Created May 6, 2011 15:42
Bootrsap of RVM
cat <<'BOOTSTRAP_AS_USER' > /home/$app_user/bootstrap_as_user.sh
set -e
bash < <( curl --insecure https://rvm.beginrescueend.com/install/rvm )
rvm_include_string='[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"'
grep "$rvm_include_string" ~/.bashrc || echo "$rvm_include_string" >> ~/.bashrc
cat <<'RVMRC_CONTENTS' > ~/.rvmrc
@daffydowden
daffydowden / Setup for new Mac
Created September 15, 2010 14:21
Installation for Ruby,RVM,REE,RubyCocoa,Passenger, MySql
Borrows heavily from: http://eddorre.com/posts/using-ruby-enterprise-edition-and-passenger-on-os-x-with-rvm
Install Xcode
Update Xcode if necessary
Install oh-my-zsh
https://github.com/robbyrussell/oh-my-zsh#readme
Install homebrew: http://mxcl.github.com/homebrew/
@actsasflinn
actsasflinn / msgpack_benchmark.rb
Created January 30, 2010 05:07
Message Pack vs similar utilities
=begin
Message Pack vs similar utilities
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.0.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02
Packing
user system total real
pack: bert 18.320000 0.770000 19.090000 ( 19.101583)
pack: bson_ext 0.850000 0.030000 0.880000 ( 0.878398)
pack: json_ext 2.540000 0.040000 2.580000 ( 2.582495)