Skip to content

Instantly share code, notes, and snippets.

View semmons99's full-sized avatar

Shane Emmons semmons99

View GitHub Profile
@semmons99
semmons99 / rlsp.rb
Created November 8, 2009 23:20 — forked from h0rs3r4dish/rlsp.rb
#!/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
def parse(name)
case name
when /^\[(.+)\](.+)\[(.+)\]$/
[ $1 + $2 + $3, $1 + $2, $2 + $3, $2 ]
when /^\[(.+)\](.+)$/
[ $1 + $2, $2 ]
when /^(.+)\[(.+)\]$/
[ $1, $1 + $2 ]
else
[ name ]
---
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:
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
require "spec_helper"
describe AdjacencyMatrix do
context "undirected graph" do
let(:pitt2pitt) {
AdjacencyMatrix.connections({"Pittsburgh" => "Pittsburgh"}, false)
}
let(:pitt2clev) {
AdjacencyMatrix.connections({"Pittsburgh" => "Cleveland"}, false)
require "spec_helper"
describe AdjacencyMatrix do
context "undirected graph" do
let(:pitt2pitt) {
AdjacencyMatrix.connections({"Pittsburgh" => "Pittsburgh"}, false)
}
let(:pitt2clev) {
AdjacencyMatrix.connections({"Pittsburgh" => "Cleveland"}, false)
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
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
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
def test_trie_with_default_value
@trie = Trie.new([])
@trie["Ape"] = "Animal"
assert_equal "Animal", @trie["Ape"]
assert_equal [], @trie["Invalid"]
end