Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
⛵️

Jon Rowe JonRowe

💭
⛵️
View GitHub Profile
@JonRowe
JonRowe / heroku_ruby_yaml.rb
Created Feb 8, 2014
Update heroku apps running old versions of libyaml.
View heroku_ruby_yaml.rb
require 'json'
class Shell
def self.heroku_apps
new('heroku apps').cache_at 'heroku_app_cache'
end
def self.ruby_version app
new("heroku run \"ruby -v\" --app #{app}").cache_at "ruby_version_#{app}"
end
View prepend_class.rb
module B
def a
puts 'b'
super
end
end
class A
class << self; prepend B; end
def self.a
@JonRowe
JonRowe / db_spec_helper.rb
Last active Aug 29, 2015
Delay the slow things!
View db_spec_helper.rb
# An example used to segregate DB loading to those specs requiring it only.
RSpec.configure do |config|
config.include DBHelper::DB, db: true
config.include DSL::Setup, db: true
config.before(:all, db: true) do
DBHelper.load!
end
@JonRowe
JonRowe / pre-recieve-hook
Last active Aug 29, 2015
A git pre-receive hook for Ruby deploying.
View pre-recieve-hook
#!/bin/bash
# Let's deploy...
echo "Deploying..."
echo "Deploying as: `whoami`"
# turn on failing script on any command fail
set -e
set -o pipefail
@JonRowe
JonRowe / upgrade_ruby_pysch.rb
Created Apr 3, 2014
Updated script for updating psych. lul.
View upgrade_ruby_pysch.rb
require 'json'
class Shell
def self.heroku_apps
new('heroku apps').cache_at 'heroku_app_cache'
end
def self.ruby_version app
new("heroku run \"ruby -v\" --app #{app}").cache_at "ruby_version_#{app}"
end
@JonRowe
JonRowe / mbp.md
Last active Aug 29, 2015
For Sale! 15" Macbook Pro (Mid 2010)
View mbp.md

15" Macbook Pro (Mid 2010)

I'm selling my Macbook Pro (Mid 2010), it has commited many many lines of code, it has written chunks of RSpec, it has fought the rubies and won. It has travelled 17000km to Australia and survived, but now it must be passed on to a worth successor.

The specs:

  • Display: 15" 1680x1050 display.
  • Processor: 2 core / 4 thread 2.66GHz Intel Core i7.
  • Memory: 8GB DDR3
  • Video card: PCIe 512MB NVIDIA GeForce GT 330M
View gist:271543
<script type="text/javascript">
// FORK IDEA
// By wrapping in try catch you can fallback to Typekit's default JS if they change the experimental feature.
try
{
// *** EXPERIMENTAL ***
//
// This is an experimental method to be notified when Typekit's fonts have loaded.
@JonRowe
JonRowe / Gemfile
Created Jan 26, 2010
Gemfile to allow bundling Merb 1.0.15 via Bundler... read symlink instructions...
View Gemfile
# This Gemfile is a cheat
# It allows bundling via bundler using Merb 1.0.15
# To use this you *MUST* symlink gems/gems to gems/ruby/1.8/gems etc.
# I recommend symlinking gems/gems gems/cache gems/specification gems/doc just to be sure
bundle_path "gems"
bin_path "bin"
def self.dependency(*args)
gem(*args)
View llvm-gcc binary locations
ls -al /usr/llvm-gcc-4.2/bin/
total 9280
drwxrwxr-x 11 root admin 374 20 Jan 06:46 .
drwxrwxr-x 7 root admin 238 20 Jan 06:45 ..
-rwxrwxr-x 1 root admin 201664 20 Jan 06:45 gcov-4.2
-rwxrwxr-x 1 root admin 859664 20 Jan 06:45 i686-apple-darwin10-llvm-g++-4.2
-rwxrwxr-x 1 root admin 851472 20 Jan 06:45 i686-apple-darwin10-llvm-gcc-4.2
-rwxrwxr-x 1 root admin 182512 20 Jan 06:45 llvm-c++-4.2
-rwxrwxr-x 1 root admin 562896 20 Jan 06:45 llvm-cpp-4.2
View gist:464185
class Capybara::Driver::RackTest
private
def env
env = {}
begin
env["HTTP_REFERER"] = request.url
env["HTTPS"] = "on" if request.url =~ /^https/
rescue Rack::Test::Error
# no request yet
end