Skip to content

Instantly share code, notes, and snippets.

View ryansch's full-sized avatar

Ryan Schlesinger ryansch

View GitHub Profile
@davelyon
davelyon / Guardfile
Created June 21, 2011 18:39
Guardfile
require 'guard/rspec'
extensions = ["Guard::RSpec", "Guard::Schema", "Guard::Routes"]
module ::Guard
class Schema < ::Guard::Guard
def run_on_change(_)
UI.info "Clearing the way"
`rake db:test:prepare`
UI.clear
UI.info "Ready to lead the charge!"
require 'daemon_controller'
require 'socket'
REPO_DIR = '/path/to/repos'
WHITELIST = %w{hostthis}
LISTEN = '1.2.3.4'
PORT = '9418'
PID_FILE = 'git-daemon.pid'
LOG_FILE = 'git-daemon.log'
LOCK_FILE = "#{PID_FILE}.lock"
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@metaskills
metaskills / wait_until.rb
Last active May 2, 2024 01:51
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@grosser
grosser / resque_web.rb
Created September 13, 2011 15:08 — forked from skippy/resque_web.rb
Mountable resque-web for rails 3+ apps
# https://gist.github.com/1214052
require 'sinatra/base'
class ResqueWeb < Sinatra::Base
require 'resque/server'
use Rack::ShowExceptions
if CFG[:user].present? and CFG[:password].present?
Resque::Server.use Rack::Auth::Basic do |user, password|
user == CFG[:user] && password == CFG[:password]
@nruth
nruth / gist:1264245
Last active August 23, 2021 01:57
Shared Capybara (or model setup) helpers for RSpec and Cucumber
# Let's assume you're driving Capybara in both RSpec request specs & Cucumber,
# for example you're using Cucumber as a design/documentation tool, and RSpec
# for the more boring integration tests.
# You don't want to duplicate your click-this-click-that helpers to e.g.
# log_in(username, password).
# You may also have model state setup code which can be shared/reused.
# Where can it go? How can it be loaded? I've been using the following approach:
#
@developish
developish / duration_spec.rb
Created October 15, 2011 02:55
How to create an isolated ActiveRecord connection for testing without breaking the rest of the suite.
require "active_record"
require "lib/duration"
class Event < ActiveRecord::Base
include Duration
end
describe Duration do
before do
ActiveRecord::Base.establish_connection(
@thbar
thbar / initializer.rb
Created October 26, 2011 20:54
Removing sensitive resque args from airbrake notifications
Resque::Failure::SensitiveAirbrake.configure do |config|
config.api_key = @config['airbrake']['api_key']
config.params_filters << 'my_sensitive_job_arg'
config.secure = @config['airbrake']['secure']
config.proxy_host = @config['airbrake']['proxy_host']
config.proxy_port = @config['airbrake']['proxy_port']
config.host = @config['airbrake']['host']
config.logger = Logger.new(STDOUT)
end
@soemarko
soemarko / theme.html
Created November 26, 2011 16:18
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
@jamiequint
jamiequint / stripe_coffeescript
Created December 9, 2011 00:00
Stripe Form Javascript Translated to CoffeeScript
Stripe.setPublishableKey('YOUR_PUBLISHABLE_KEY');
$("#payment-form").submit((event) ->
# disable the submit button to prevent repeated clicks
$('.submit-button').attr("disabled", "disabled")
Stripe.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),