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
moby = <<EOL | |
Call me Ishmael. Some years ago - never mind how long precisely - having little | |
or no money in my purse, and nothing particular to interest me on shore, I | |
thought I would sail about a little and see the watery part of the world. | |
[Moby Dick - 1st paragraph] | |
EOL | |
# | |
# Passively store your match the old way: "$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
traceroute theslingshot.com | |
traceroute to theslingshot.com (173.245.61.159), 30 hops max, 60 byte packets | |
1 10.10.20.1 (10.10.20.1) 5.886 ms 7.314 ms 7.710 ms | |
2 74-92-190-118-Illinois.hfc.comcastbusiness.net (74.92.190.118) 13.226 ms 14.104 ms 14.397 ms | |
3 96.120.25.193 (96.120.25.193) 53.888 ms 54.198 ms 54.463 ms | |
4 te-1-8-ur13.area4.il.chicago.comcast.net (68.86.114.105) 31.096 ms 32.892 ms 33.477 ms | |
5 te-8-2-ur12.area4.il.chicago.comcast.net (68.87.231.25) 32.515 ms 33.003 ms 33.876 ms | |
6 te-2-2-0-2-ar01.area4.il.chicago.comcast.net (68.87.232.225) 34.667 ms 14.280 ms 25.691 ms | |
7 pos-3-6-0-0-cr01.350ecermak.il.ibone.comcast.net (68.86.95.9) 24.770 ms 25.194 ms 25.335 ms | |
8 be-12-pe03.350ecermak.il.ibone.comcast.net (68.86.84.190) 23.508 ms 24.095 ms 24.365 ms |
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
http://wiki.nginx.org/NginxHttpCoreModule#location | |
Example: | |
location = / { | |
# matches the query / only. | |
[ configuration A ] | |
} | |
location / { | |
# matches any query, since all queries begin with /, but regular |
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
# | |
# Public: This class uses Rubys native hash data type for immediate data manipulation. This serializes the data to JSON where it is stored into a Redis backend for persistence. | |
# It contains a namespace and a rd_key, it will store the data as JSON into "[namespace]:[key]" | |
# | |
# Assumes REDIS = Redis.new (redis connection) | |
# | |
# Examples | |
# | |
# foo = PersistentJhash.new | |
# foo.namespace |
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
describe Ss::PersistentJhash do | |
before do | |
tmp = Ss::PersistentJhash.new | |
tmp.clear.save | |
assert tmp.send(:conn) | |
tmp.load_data.must_be :empty? | |
end | |
it "is a hash" do |
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 'digest/md5' | |
require 'savon' | |
require 'open-uri' | |
# Public: Various methods to get information from the Ivona cloud service | |
# | |
# | |
# Examples | |
# | |
# url = IvonaTts.synthesize(user: "[your user name]", |
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
# Public: Subscriber class for digesting conn messages | |
# | |
# channel - Channel to subscribe to | |
# block - Block for digesting message (opt) | |
# | |
# Examples | |
# | |
# # With a block! | |
# Subscriber.new("test").start | |
# #=> "Subscribed to #test" |
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
Subscriber.new(channel) do |_, m| | |
begin | |
hsh = JSON.parse(m) | |
logger = ENV["RACK_ENV"] == "development" ? $stdout : $stderr | |
klass = hsh["class"] | |
method = hsh["method"] | |
args = hsh["args"] |
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 'rss/1.0' | |
require 'rss/2.0' | |
require 'open-uri' | |
require 'json' | |
# Class handles reading, processing RSS feeds | |
# | |
# Examples | |
# | |
# # GOOD |
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
create_table :alarms do | |
primary_key :id | |
Integer :local_day | |
Time :local_time | |
Integer :utc_day | |
Integer :utc_time_in_sec | |
Text :zone | |
end |