Skip to content

Instantly share code, notes, and snippets.


Ian Vaughan IanVaughan

View GitHub Profile
IanVaughan / gist:9187837
Created Feb 24, 2014
xray rails error with Angular view
View gist:9187837
TypeError - no implicit conversion of String into Hash:
xray-rails (0.1.12) lib/xray/config.rb:46:in `load_config'
xray-rails (0.1.12) lib/xray/config.rb:14:in `editor'
xray-rails (0.1.12) app/views/_xray_bar.html.erb:35:in `___sers_ian__rbenv_versions_______p____lib_ruby_gems_______gems_xray_rails________app_views__xray_bar_html_erb__3419748363069709208_70297798074320'
() Users/ian/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/bundler/gems/rails-b6fc77c3368d/actionpack/lib/action_view/template.rb:145:in `block in render'
() Users/ian/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/bundler/gems/rails-b6fc77c3368d/activesupport/lib/active_support/notifications.rb:125:in `instrument'
() Users/ian/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/bundler/gems/rails-b6fc77c3368d/actionpack/lib/action_view/template.rb:143:in `render'
xray-rails (0.1.12) lib/xray/engine.rb:30:in `render_with_xray'
() Users/ian/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/bundler/gems/rails-b6fc77c3368d/actionpack
IanVaughan / convert_aws_to_fog.rb
Created Apr 2, 2014
Converts AWS_CREDENTIAL_FILE to a .fog one
View convert_aws_to_fog.rb
#!/usr/bin/env ruby
require 'yaml'
unless filename = ENV['AWS_CREDENTIAL_FILE']
puts "No AWS_CREDENTIAL_FILE file found!"
exit 1
credentials = Hash[ { |line| line.chomp.split('=') }]
IanVaughan / raise-in-users-class.rb
Created Apr 9, 2014
Example of raising in the callers class, not the where the method_missing is defined.
View raise-in-users-class.rb
class Base
def method_missing(method, *args, &block)
yield block if block_given?
rescue NoMethodError, NameError => e
raise e, e.exception, e.backtrace[1..-1]
class UsesBase < Base
IanVaughan /
Created Oct 11, 2014
Make your internet like the 80ies
help() {
echo 'G o S L O W ...'
stop() {
sudo ipfw delete 1
sudo ipfw delete 2
sudo ipfw pipe 1 delete
IanVaughan / move_todo.rb
Created Nov 6, 2014
Move TODOs from code to GitHub
View move_todo.rb
require 'github_api'
path = '.'
USER = 'user'
REPO = 'repo'
OAUTH_TOKEN = 'xxxx'
def files(path)
(`ag TODO #{path} -l`).split
IanVaughan / upload_to_s3.rb
Last active Aug 29, 2015
Uploads a given file to S3 bucket and sets permissions to Everyone:Read/Download
View upload_to_s3.rb
#!/usr/bin/env ruby
# Uploads a given file to S3 bucket
# and sets permissions to Everyone:Read/Download
# (Default of Tech:Read/Write/Delete still set)
# Uses config in ~/.fog if present,
# otherwise falls back to using ENV vars
# export AWS_ACCESS_KEY_ID=xxx
IanVaughan / invalid_records.rb
Last active Aug 29, 2015
Finds invalid rails records
View invalid_records.rb
#!/usr/bin/env ruby
puts "Loading Rails..."
require 'ruby-progressbar'
require './config/environment'
require "csv"
puts "Booting Rails..."
View cucumber
#!/usr/bin/env ruby
args = *ARGV
if File.exists?('.zeus.sock')
puts "=> Using Zeus..."
exec "zeus cucumber #{args.join(' ')}"
puts "=> NOT Using Zeus..."
exec "bundle exec cucumber #{args.join(' ')}"
brew install boot2docker
boot2docker init
boot2docker up
# To connect the Docker client to the Docker daemon, please set:
export DOCKER_HOST=tcp://
export DOCKER_CERT_PATH=/Users/ian/.boot2docker/certs/boot2docker-vm