View settings.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Restores lederman-rails-settings 1.x global Settings interface | |
class Settings < ActiveRecord::Base | |
serialize :value | |
def self.[](var) | |
find_by_var(var).try :value | |
end | |
def self.[]=(var, value) | |
setting = find_or_initialize_by(var: var) |
View gist:d6908cb8b710e2ad6fc9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('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">'));}) |
View post-checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PHP Sucks | |
Description: Missing PHP functions | |
Version: 1.0 | |
*/ | |
namespace PHPSucks { | |
class Arr { | |
static function reject($fcn, $arr) { |
View deploy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set New Relic user to git user name if it's set | |
`git config --global user.name`.strip.tap do |user| | |
set(:newrelic_user, user) unless user.empty? | |
end |
View gist:5287837
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
expect(page).to have_content '${1:content}' | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>ephc</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.ruby</scope> | |
</snippet> |
View gist:5287776
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
fill_in '${1:field}', with: '${2:text}' | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>fiw</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.ruby</scope> | |
<description>Capybara fill_in snippet</description> | |
</snippet> |
View gist:3837269
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -n "Client ID: " | |
read client_id | |
echo -n "Client secret: " | |
read client_secret | |
echo -n "Redirect URI: " | |
read redirect_uri |
View railsconf2012.ics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN:VCALENDAR | |
PRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN | |
CALSCALE:GREGORIAN | |
VERSION:2.0 | |
BEGIN:VEVENT | |
DTEND;VALUE=DATE-TIME:20120423T180000 | |
DTSTART;VALUE=DATE-TIME:20120423T173000 | |
DESCRIPTION:Rich Hickey\, the author of <a href="http://clojure.org/">Clo | |
jure</a> and designer of <a href="http://datomic.com/">Datomic</a>\, is | |
a software developer with over 20 years of experience in various domains |
View Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "http://rubygems.org" | |
gem 'json' | |
gem 'ri_cal' | |
gem 'tzinfo' |
NewerOlder