-
This is a numbered list.
-
I'm going to include a fenced code block as part of this bullet:
Code More Code
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
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!" |
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
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" |
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
# 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 |
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
# 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] |
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
# 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: | |
# |
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
require "active_record" | |
require "lib/duration" | |
class Event < ActiveRecord::Base | |
include Duration | |
end | |
describe Duration do | |
before do | |
ActiveRecord::Base.establish_connection( |
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
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 |
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
<!-- 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> | |
--> |
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
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(), |