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
location / { | |
root /my/web/site; | |
# Note (1) the '/' before $lang and (2) the lack of '/' before $uri (which | |
# already starts with '/'). | |
try_files /$lang$uri /$lang$uri.html /$lang$uri/ $uri $uri.html $uri/ =404; | |
} |
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 'capybara/rails' | |
require 'capybara/cucumber' |
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 'sinatra' | |
require 'csrf' | |
use Rack::Session::Cookie | |
apply_csrf_protection | |
# Here follow the route handlers. |
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
# Basic: add a `gallery` attribute to the YAML header of any page with value | |
# being the extension of your images. Every image with that extension stored | |
# inside the page's directory (and every one of its subdirectories) will be | |
# added to the `gallery_items` attribute of that same page (alphabetically | |
# sorted). | |
module Jekyll | |
class Gallery < Generator | |
safe true |
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 'rubygems' | |
require 'fog' | |
bucket_name = 'my_bucket' | |
object_name = 'big.zip' | |
# Part size must be between 5MB and 5GB. | |
# (http://docs.amazonwebservices.com/AmazonS3/latest/dev/qfacts.html) | |
# Let's say we've splitted the original file with split(1). |
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 'rubygems' | |
require 'irb/completion' | |
if ENV['RAILS_ENV'] | |
# Redirecting ActiveRecord's messages to stdout. RoR2 | |
require 'logger' | |
Object.const_set :RAILS_DEFAULT_LOGGER, Logger.new(STDOUT) | |
elsif Object.const_defined? :RAILS_ENV | |
# Redirecting ActiveRecord's messages to stdout. RoR3 | |
ActiveRecord::Base.logger = Logger.new STDOUT |
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
# Adding a host record. | |
sudo dscl . -create /Hosts/www.example.com ip_address 10.1.2.3 | |
# Removing that same host record. | |
sudo dscl . -delete /Hosts/www.example.com |
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
Scenario: Deleting a user | |
When I go to the users page | |
And follow "Delete" for the 2nd user | |
Then I should be on the users page | |
And should not see "user2" |
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
# Drop it in config/deploy/ | |
# | |
# It's evaluated inside the deploy resource's context. | |
# | |
# It assumes Gemfile and Gemfile.lock are present and satisfy Bundler's | |
# requirements for the --deployment option. | |
current_release_directory = release_path | |
running_deploy_user = new_resource.user | |
bundler_depot = new_resource.shared_path + '/bundle' |