Skip to content

Instantly share code, notes, and snippets.

Jim Ryan jimryan

Block or report user

Report or block jimryan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jimryan / settings.rb
Last active Mar 24, 2017
Restore lederman-rails-settings global Settings
View settings.rb
# Restores lederman-rails-settings 1.x global Settings interface
class Settings < ActiveRecord::Base
serialize :value
def self.[](var)
find_by_var(var).try :value
def self.[]=(var, value)
setting = find_or_initialize_by(var: var)
View gist:d6908cb8b710e2ad6fc9
$('article div img').each(function(){scale = $(this).width()/this.naturalWidth;$(this).replaceWith($('<iframe src="'+$(this).attr('src')+'.html'+'" scrolling="no" style="width:'+100/scale+'%;height:'+100/scale+'%;position:absolute;left:0;top:0;transform: scale('+scale+');transform-origin:0 0">'));})
jimryan / post-checkout
Last active Apr 12, 2016
Save and restore the state of your Rails development and test databases as you work on different branches
View post-checkout
#!/usr/bin/env ruby
require 'yaml'
# If this was a branch checkout
if ARGV[2] == '1'
def dump(database_name, branch_name)
print "Saving state of #{database_name} on '#{branch_name}' branch..."
if system(%[pg_dump -c -f "#{@dump_folder}/#{database_name}-#{branch_name}" #{database_name}])
View php-sucks.php
Plugin Name: PHP Sucks
Description: Missing PHP functions
Version: 1.0
namespace PHPSucks {
class Arr {
static function reject($fcn, $arr) {
jimryan / deploy.rb
Created Jun 28, 2013
Use git config value for New Relic deploy user in Capistrano
View deploy.rb
# Set New Relic user to git user name if it's set
`git config --global`.strip.tap do |user|
set(:newrelic_user, user) unless user.empty?
jimryan / gist:5287837
Created Apr 1, 2013
Capybara expect(page).to have_content SublimeText snippet
View gist:5287837
expect(page).to have_content '${1:content}'
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
jimryan / gist:5287776
Last active Dec 15, 2015
Capybara fill_in with SublimeText snippet
View gist:5287776
fill_in '${1:field}', with: '${2:text}'
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<description>Capybara fill_in snippet</description>
jimryan / gist:3837269
Created Oct 5, 2012
GCP Authenticator Script
View gist:3837269
echo -n "Client ID: "
read client_id
echo -n "Client secret: "
read client_secret
echo -n "Redirect URI: "
read redirect_uri
jimryan / railsconf2012.ics
Created Apr 21, 2012
RailsConf 2012 iCal
View railsconf2012.ics
PRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN
DESCRIPTION:Rich Hickey\, the author of <a href="">Clo
jure</a> and designer of <a href="">Datomic</a>\, is
a software developer with over 20 years of experience in various domains
jimryan / Gemfile
Created Apr 21, 2012
RailsConf 2012 ical generator
View Gemfile
source ""
gem 'json'
gem 'ri_cal'
gem 'tzinfo'
You can’t perform that action at this time.