Skip to content

Instantly share code, notes, and snippets.

View moutten's full-sized avatar

Matt Outten moutten

  • Squaremouth
  • Fort Wayne, IN
View GitHub Profile
#!/bin/zsh
# Fixes ssl certificate errors with Ruby 1.9.3 when using RVM
if [[ -s $HOME/.rvm/usr/ssl ]] ; then curl http://curl.haxx.se/ca/cacert.pem -o ~/.rvm/usr/ssl/cert.pem ; fi
if [[ -s /usr/local/etc/openssl ]] ; then curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/etc/openssl/cert.pem ; fi
@moutten
moutten / import.zsh
Created August 24, 2012 18:48
Import ssh keys into Amazon AWS regions using Amazon EC2 API Tools (ZSH only)
# This requires you install the command line tools from Amazon, and setup your Amazon credentials appropriately.
# - http://aws.amazon.com/developertools/351/
for region (us-east-1 us-west-1 us-west-2) ec2-import-keypair $USER -f ~/.ssh/id_rsa.pub --region $region
# Steps to reproduce the problem
rails new my_app
cd my_app
echo "gem 'instrumental_agent', '0.9.0'" >> Gemfile
bundle
rake -T
class ApplicationController < ActionController::Base
before_filter :delay_xhr
protected
def delay_xhr
session[:delay_ajax] = params[:delay_ajax].to_i unless params[:delay_ajax].blank?
sleep session[:delay_ajax] if !session[:delay_ajax].nil? && session[:delay_ajax] > 0 && request.xhr?
end
Steps to migrate a Rails 2.3 project to bundler.
1. Install bundler
gem install bundler
2. Remove existing vendor gems directory
rm -rf vendor/gems
# Selenium
SELENIUM_JAR=`ruby -rrubygems -e 'require "webrat";\
Webrat.configuration.mode = :selenium; \
print Webrat::Selenium::SeleniumRCServer.new.jar_path'`
alias selenium="java -jar $SELENIUM_JAR -singleWindow"
#!/usr/bin/env ruby
require 'rubygems'
require 'webrat'
Webrat.configuration.mode = :selenium
selenium = Webrat::Selenium::SeleniumRCServer.new
puts "java -jar "+selenium.jar_path+" -singleWindow"
system("java -jar "+selenium.jar_path+" -singleWindow")
--type-add=ruby=.haml,.rake,.rsel,.spec,.feature
alias vmware='ssh -X -f -q sqm@sqm-vm-server bin/start-vmware-console.sh'
###############################################
# place in /app/helpers/application_helper.rb #
###############################################
def bodytag_id
a = controller.controller_name.underscore
b = controller.action_name.underscore
"#{a}-#{b}".gsub(/_/, '-')
end
def bodytag_class