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
/* | |
* Copyright (C) 2012 Marian Marinov <mm@yuhu.biz> | |
* | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, |
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
chef-solr-10.14.0.beta.1.gem | |
jenkins-0.6.7.gem | |
milia-0.3.14.gem | |
scale_down-0.5.1.gem | |
rubydraw-0.2.4.gem | |
viewcumber-0.2.0.gem | |
routo-0.0.1.gem | |
qm-acts-as-generic-controller-0.0.3.gemspec.rz | |
wcfrestcontrib-1.0.5.0.gemspec.rz | |
routo-0.0.1.gemspec.rz |
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
ruby_version="1.9.3-p392" | |
gem_version="1.8.25" | |
if [ ! -f /tmp/ruby/bin/ruby ]; then | |
cd /tmp | |
rm -f ruby-${ruby_version}.tar.gz | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-${ruby_version}.tar.gz | |
tar zxvf ruby-${ruby_version}.tar.gz | |
cd ruby-${ruby_version} | |
(./configure --prefix=/tmp/ruby && make -j4 && make install) || (echo "Ruby shat the bed" && exit 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
def decrypt(value) | |
escape_and_execute_sql( | |
["SELECT AES_DECRYPT(?, ?)", Base64.decode64(value), key]).first || value | |
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
class String | |
def surround(left, right = nil) | |
right ||= left | |
unless self.empty? | |
"#{left}#{self}#{right}" | |
end | |
end | |
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
describe Car | |
subject(:car) { Car.new } | |
its(:engine) { should be_a(V8) } | |
its(:color) { should == 'blue' } | |
it "stops the car" do | |
car.break! | |
car.should be_stopped | |
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
class OpenStruct | |
def initialize(hash=nil) | |
@table = {} | |
if hash | |
for k,v in hash | |
@table[k.to_sym] = v | |
new_ostruct_member(k) | |
end | |
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
SET FOREIGN_KEY_CHECKS = 0; | |
SET UNIQUE_CHECKS = 0; | |
SET AUTOCOMMIT = 0; | |
SQLDUMP_DATA | |
SET UNIQUE_CHECKS = 1; | |
SET FOREIGN_KEY_CHECKS = 1; | |
COMMIT; |
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
original = { "total_memory"=>49143, "total_cpus"=>24, "memory_overhead"=>13800, "free_memory"=>35343, "label" => "cake" } | |
keys_i_want = ["label", "free_memory"] | |
my_hash = {} | |
keys_i_want.each {|i| my_hash[i] = original[i]} | |
p original | |
p my_hash | |
# OR |
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://rubygems.org/api/v1/dependencies?gems=jruby-pageant,needle,termios,coffee-script-source,libxml-ruby,hike,ref,libv8,rb-fchange,polyglot,facets,hpricot,sexp_processor,RubyInline,SexpProcessor,eventmachine,thin,xpath,selenium-webdriver,celerity,culerity,addresasble,rcov,ZenTest,rubyforge,gemcutter,diff-lcs,gherkin,term-ansicolor,abstract,multimap,tlsmail,text-hyphen,oauth2,roauth,english,rack-protection,mongrel,spruz,hashery,ruby-rc4,Ascii85,little-plugger,lockfile,flexmock,aruba,right_http_connection |