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 'launchy' | |
if File.exists?(ARGV[0]) | |
sites = File.open(ARGV[0]) | |
sites.each { |line| Launchy.open(line)} | |
else | |
abort "No link file found (#{ARGV[0]}), usage is 'popsites <linkfile>'" |
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
class WordIndexCipher | |
attr_accessor :source_text, :character_table | |
def initialize(text) | |
@source_text = text.upcase.split(' ') | |
make_character_table | |
end | |
def encode(text) | |
@cipher = "" |
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
Somebody say something! |
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
def self.pretty_hash(hash) | |
results = [] | |
hash.keys.each do |key| | |
results << key | |
if hash[key].respond_to?(:keys) | |
results << pretty_hash(hash[key]).split("\n").map do | line | | |
" -- " + line | |
end | |
end | |
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
Pigeons cannot lick their own necks. | |
This rarely appears to impede them. |
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
# Configure these lines for your app prior to launch. | |
# Application Name is the folder it will deploy to. | |
# Script Name is the name of the logfile and the god script. | |
# Start Command is the command god will issue to start the process. | |
APPLICATION_NAME = "FayeServer" | |
SCRIPT_NAME = "faye" | |
REPOSITORY = "git://github.com/HungryAcademyTeam4/FayeServer.git" | |
START_COMMAND = 'rainbows /apps/FayeServer/current/faye.ru -c /apps/FayeServer/current/rainbows.conf -E production -p 9000' |
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
class Board | |
def initialize | |
@squares = {} | |
101.times do |n| | |
@squares[n] = n | |
end | |
@squares.delete(0) | |
set_active_squares | |
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
class Class | |
def hipster_attr(*methods) | |
methods.each do |method| | |
define_method(method) do | |
instance_variable_get("@#{method}") | |
end | |
setter = method.to_s + "=" | |
define_method(setter.to_sym) do |value| | |
instance_variable_set("@#{method}", value) |
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
Sinatra 1.4.4 | |
Rails 4.0.1 | |
Rails-API 0.1.0 | |
Rails-API disabled Mailer and Sockets | |
Each app connected to a MySQL database via ActiveRecord with an empty Accounts table; each app's root path responded with "#{Account.count} accounts detected." | |
Each app was configured to use Thin as its web server. |
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
class ContentProxy | |
def initialize(app) | |
@app = app | |
end | |
def should_use_cms? | |
# Some logic goes here, examining the request path and making the determination | |
# about whether to render using the CMS engine or let the request bubble up | |
# to the Rails app. This example looks for URIs starting with "/blog" | |
env['REQUEST_URI'] =~ /^\/blog/ |