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
this is a test blah |
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' | |
require 'active_record' | |
require 'active_support' | |
ActiveRecord::Base.establish_connection( | |
:adapter => :mysql, | |
:socket => '/var/run/mysqld/mysqld.sock', | |
:username => 'root', | |
:database => 'ngrams', | |
:password=> 'xxx' |
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
-startup | |
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar | |
--launcher.library | |
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.0.v20100503 | |
-product | |
org.eclipse.epp.package.jee.product | |
--launcher.defaultAction | |
openFile | |
-showsplash | |
org.eclipse.platform |
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" | |
require "nokogiri" | |
f = File.open "ota/samples/rateplan-rs.xml" | |
doc = Nokogiri::XML(f) | |
f.close | |
ns = {"http://www.opentravel.org/OTA/2003/05"=>"http://www.opentravel.org/OTA/2003/05", "xmlns:ota"=>"http://www.opentravel.org/OTA/2003/05", "xmlns:seekda"=>"http://connect.seekda.com/2009/04"} | |
xp = ".//ota:RatePlans" | |
puts doc.xpath(xp, ns) |
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' | |
require 'sinatra' | |
require 'dm-core' | |
require 'dm-migrations' | |
DataMapper::setup(:default, "sqlite3://#{File.expand_path(File.dirname(__FILE__))}/tmp/participants.db") | |
class Participant | |
include DataMapper::Resource |
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' | |
require 'redis' | |
def main(opts={}) | |
r = Redis.new(opts) | |
um = 0 | |
while true do | |
newum = r.info['used_memory'] | |
if newum != um && um != 0 | |
diff = newum.to_i-um.to_i |
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 availabilities for hotels | |
# each set contains the hotels which have availability | |
# for a particular day (specified by id) / guest-count | |
redis = Redis.new | |
redis.flushall | |
oldmem = redis.info['used_memory'].to_i | |
(1..3000).each do |hotel| |
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
# see https://github.com/antirez/redis/blob/master/redis.conf | |
# set set-max-intset-entries 512 to 4096 for our purpose (3000 hotels) | |
# https://github.com/kni/redis-sharding | |
# http://groups.google.com/group/redis-db/browse_thread/thread/ba41db36013c7cb9 | |
# | |
require 'rubygems' | |
require "redis" | |
require 'date' |
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
# temporary (for gem) | |
gem 'activeldap' | |
gem 'net-ssh' | |
gem 'money' | |
#gem 'seekda-comm' | |
gem 'sinatra' | |
gem 'haml' | |
gem 'pdfkit' | |
gem 'wkhtmltopdf-binary' |
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 Event < Ohm::Model | |
attribute :name | |
reference :venue, Venue | |
set :participants, Person | |
counter :votes | |
index :name | |
def validate | |
assert_present :name |