Skip to content

Instantly share code, notes, and snippets.

@akodkod
akodkod / Gemfile.rb
Last active December 18, 2015 12:10
Rails Gems for Developing
group :development
gem 'better_errors' # better errors pages (https://github.com/charliesome/better_errors)
gem 'binding_of_caller' # console for better errors
gem 'jazz_hands' # cool rails console `rails c` (https://github.com/nixme/jazz_hands)
gem 'quiet_assets' # speed up assets & clear log (https://github.com/evrone/quiet_assets)
gem 'bullet' # optimize queries (https://github.com/flyerhzm/bullet)
end
@baldowl
baldowl / import.rb
Created January 8, 2012 16:41 — forked from juniorz/import.rb
Import a blogger archive to jekyll (octopress version)
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@sandipransing
sandipransing / template.rb
Created February 28, 2011 19:20 — forked from cdmwebs/template.rb
Rails 3 template
generators = []
puts 'Spinning up a new app, captain!'
devise = yes?('Use Devise? (yes/no)')
jquery = yes?('Use jQuery? (yes/no)')
jquery_ui = yes?('Use jQuery UI? (yes/no)') if jquery
mongoid = yes?('Use mongoid? (yes/no)')
haml = yes?('Use haml? (yes/no)')
rspec = yes?('Use Rspec? (yes/no)')
@sandipransing
sandipransing / gist:810950
Created February 4, 2011 10:10
delayed_job
#! /bin/sh
set_path="cd /home/josh/current"
case "$1" in
start)
echo -n "Starting delayed_job: "
su - root -c "$set_path; RAILS_ENV=production script/delayed_job start" >> /var/log/delayed_job.log 2>&1
echo "done."
;;
stop)
@sandipransing
sandipransing / gist:810949
Created February 4, 2011 10:09
rails.monitrc
check process nginx with pidfile /opt/nginx/logs/nginx.pid
start program = "/opt/nginx/sbin/nginx"
stop program = "/opt/nginx/sbin/nginx -s stop"
if cpu is greater than 70% for 3 cycles then alert
if cpu > 80% for 5 cycles then restart
if 10 restarts within 10 cycles then timeout
check process sphinx with pidfile /home/josh/shared/pids/searchd.pid
stop program = "/bin/bash -c 'cd /home/josh/current && /usr/bin/rake RAILS_ENV=production ts:stop'"
start program = "/bin/bash -c 'cd /home/josh/current && /usr/bin/rake RAILS_ENV=production ts:start'"
@cdmwebs
cdmwebs / template.rb
Created November 20, 2010 05:22
Rails 3 with options for devise, jquery, cucumber, capybara, rspec and mongoid
generators = []
puts 'Spinning up a new app, captain!'
devise = yes?('Use Devise? (yes/no)')
jquery = yes?('Use jQuery? (yes/no)')
jquery_ui = yes?('Use jQuery UI? (yes/no)') if jquery
mongoid = yes?('Use mongoid? (yes/no)')
haml = yes?('Use haml? (yes/no)')
rspec = yes?('Use Rspec? (yes/no)')
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')