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
#!/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
# 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
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
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
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
# disable indexing on the backup disk | |
sudo mdutil -i off /Volume/MyBackupDisk | |
# delete Spotlight's indexes | |
sudo rm -rf /Volume/MyBackupDisk/.Spotlight-V100 | |
# re-enable indexing | |
sudo mdutil -i on /Volume/MyBackupDisk |
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
open /Applications/Install\ Xcode.app/Contents/Resources/Xcode.mpkg |
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 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby import.rb my-blog.xml | |
# my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
data = File.read ARGV[0] |