The real, full repository for this game is at https://github.com/roryokane/pegs-in-puzzlescript.
This Gist is just used by http://www.puzzlescript.net/play.html?p=87985a8a36b10c3ec386 to load the game in your browser.
The real, full repository for this game is at https://github.com/roryokane/pegs-in-puzzlescript.
This Gist is just used by http://www.puzzlescript.net/play.html?p=87985a8a36b10c3ec386 to load the game in your browser.
class LocaleChooser | |
LOOKUP_CHAIN = [:params, :user, :session, :http, :default] | |
def self.set_by(inputs) | |
locale = nil | |
LOOKUP_CHAIN.each do |lookup| | |
locale = send("by_#{lookup}", inputs[lookup]) | |
break if locale |
LOOKUP_CHAIN = [:params, :user, :session, :http, :default] | |
def self.set_by(inputs) | |
LOOKUP_CHAIN.find_mapped do |lookup| | |
locale = send("by_#{lookup}", inputs[lookup]) | |
end | |
end |
# --------------------------- | |
# Sensical Sentence Scrambler | |
# --------------------------- | |
# This short program takes any word longer than three characters and randomly shuffles all the characters | |
# except for the first and the last. Strangely enough, sentences are still quite readable like this. | |
# **Usage** | |
# Save the file on your computer as 'scramble.rb'. | |
# From the command line, run `ruby scramble.rb "Here's my sentence."`, and it should output |
uri 'contacts', name: 'contacts' do | |
get 'contacts#index' | |
end | |
uri 'contacts/:id/addresses', name: 'contact_addresses' do | |
put 'contact_addresses#replace' | |
post 'contact_addresses#create' | |
delete 'contact_addresses#delete' | |
end |