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/ruby | |
RLSP_VERSION = "1.4.1" | |
class Lambda | |
attr_accessor :args, :body | |
def initialize(args=[],body="") | |
@args = (args.class == Array) ? args : [args] | |
@body = body | |
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
def parse(name) | |
case name | |
when /^\[(.+)\](.+)\[(.+)\]$/ | |
[ $1 + $2 + $3, $1 + $2, $2 + $3, $2 ] | |
when /^\[(.+)\](.+)$/ | |
[ $1 + $2, $2 ] | |
when /^(.+)\[(.+)\]$/ | |
[ $1, $1 + $2 ] | |
else | |
[ 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
--- | |
pik: | |
- 0.3.0 | |
- :url: https://pik.cloudfront.com/pik-0.3.0.zip | |
packages: | |
7zip: | |
:url: http://downloads.sourceforge.net/sevenzip/7za920.zip | |
Sqlite: | |
:url: http://www.sqlite.org/sqlite-dll-win32-x86-3070400.zip | |
DevKit: |
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 response_geo_weather | |
geo_weather = Hash.new {|h, k| h[k] = {}} | |
geo_weather['ip'] = geo_location.ip | |
geo_weather['current_date_time'] = weather.current_date_time | |
geo_weather['location']['latitude'] = geo_location.latitude | |
geo_weather['location']['longitude'] = geo_location.longitude | |
geo_weather['location']['city'] = geo_location.city | |
geo_weather['location']['country'] = geo_location.country | |
geo_weather['location']['country_code'] = geo_location.country_code |
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 "spec_helper" | |
describe AdjacencyMatrix do | |
context "undirected graph" do | |
let(:pitt2pitt) { | |
AdjacencyMatrix.connections({"Pittsburgh" => "Pittsburgh"}, false) | |
} | |
let(:pitt2clev) { | |
AdjacencyMatrix.connections({"Pittsburgh" => "Cleveland"}, false) |
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 "spec_helper" | |
describe AdjacencyMatrix do | |
context "undirected graph" do | |
let(:pitt2pitt) { | |
AdjacencyMatrix.connections({"Pittsburgh" => "Pittsburgh"}, false) | |
} | |
let(:pitt2clev) { | |
AdjacencyMatrix.connections({"Pittsburgh" => "Cleveland"}, false) |
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 s3 | |
Fog::Storage.new( | |
provider: "AWS", | |
aws_access_key_id: Costal::Config::AWS_ACCESS_KEY_ID, | |
aws_secret_access_key: Costal::Config::AWS_SECRET_ACCESS_KEY | |
) | |
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
def s3_find(filename) | |
keys = s3.directories.map do |directory| | |
directory.files.map do |file| | |
file.key if file.key =~ /.*#{filename}.*/ | |
end | |
end | |
keys.flatten.compact | |
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
require 'rubygems' | |
gem "minitest" | |
require 'minitest/autorun' | |
require 'minitest/pride' | |
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'trie')) | |
class TestTrie < MiniTest::Unit::TestCase |
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 test_trie_with_default_value | |
@trie = Trie.new([]) | |
@trie["Ape"] = "Animal" | |
assert_equal "Animal", @trie["Ape"] | |
assert_equal [], @trie["Invalid"] | |
end |
OlderNewer