Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'
@mrrooijen
mrrooijen / gist:3926859
Created October 21, 2012 12:35 — forked from Jared-Prime/gist:2423065
Converting RGB to HEX in Ruby
# Beginning Rubyists: simply run >> ruby hex-convertions.rb to see examples
# or use irb to build the code on the fly
# you can convert HEX to DEC using the method .to_i(base),
# which converts a string to a decimal number from the specified base number
puts "00".to_i(16)
puts "FF".to_i(16)
Mail = Ember.Application.create();
// Let's pretend that Javascript can handle mutliline strings nicely:
Mail.ApplicationView = Ember.View.extend({
template: Ember.Handlebars.compile('
<!-- this gets replaced with content based on state when
connectOutlet is called on ApplicationController -->
{{outlet}}
@mrrooijen
mrrooijen / gist:2225514
Created March 28, 2012 11:22 — forked from nvie/gist:2225508
zsh-sourcing.txt
#
# .zshenv
# .zshenv is the 1st file zsh reads; it's read for every shell, even if
# started with -f (setopt NO_RCS)
# .zprofile
# read after zshenv, if the shell is a login shell
# .zshrc
# read after zprofile, if the shell is an interactive shell
# .zlogin
# read after zshrc, if the shell is a login shell
@mrrooijen
mrrooijen / assets.rake
Created December 11, 2011 20:22 — forked from rmm5t/assets.rake
Precompile assets on Heroku with Mongoid
# The premise behind this was borrowed from https://gist.github.com/1239732
namespace :assets do
# Prepend the assets:prepare task to assets:precompile through
# assets:environment
task :environment => :prepare
task :prepare do
# Flag for custom initializers to know we're precompiling assets
ENV["RAILS_ASSETS_PRECOMPILE"] = "true"
@mrrooijen
mrrooijen / Rakefile.rb
Created August 9, 2011 22:33 — forked from carlhoerberg/Rakefile.rb
How to do automatic backup with Heroku PGBackups and Heroku Cron. http://carlhoerberg.com/automatic-backup-of-heroku-database-to-s3
require 'aws/s3'
require 'heroku'
require 'heroku/command'
require 'heroku/command/auth'
require 'heroku/command/pgbackups'
task :cron do
class Heroku::Auth
def self.client
Heroku::Client.new ENV['heroku_login'], ENV['heroku_passwd']
@mrrooijen
mrrooijen / backbone.rails.js
Created June 9, 2011 22:50 — forked from trydionel/backbone.rails.js
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@mrrooijen
mrrooijen / rails_3_1_beta_1_changes.md
Created May 12, 2011 23:48 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]

@mrrooijen
mrrooijen / monit.rc
Created May 7, 2011 14:32 — forked from anonymous/file1.ab
RVM + Monit
# thin
# assuming there's an appropriate .rvmrc in /path_to_rails_app/current
cd rails_app/current
gem install thin
rvm wrapper your_ruby@your_gemset your_app_name thin
# now we can use your_app_name_thin in Monit scripts
# /etc/monit.d
# lib/tasks/resque.rake
require 'resque/tasks'
task "resque:setup" => :environment do
ENV["VVERBOSE"] = "1" if Rails.env.development?
end
desc "Starts the heroku worker"
task "jobs:work" => :environment do