This file contains hidden or 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 "benchmark" | |
| n = 1_000_000 | |
| Benchmark.bm do |x| | |
| x.report("symbol to proc ") { Array.new(n, "45").map(&:to_i) } | |
| x.report("regular block with args") { Array.new(n, "45").map {|i| i.to_i} } | |
| end | |
This file contains hidden or 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
| #include <iostream> | |
| #include <cassert> | |
| using namespace std; | |
| #include "Rational.h" | |
| int main() | |
| { | |
| Rational c(7,3), d(3,9), x; | |
| // test == and != operator |
This file contains hidden or 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
| // ************************************************************************** | |
| // * Author: Dylan Clendenin * | |
| // ************************************************************************** | |
| #include <iostream> | |
| #include <cassert> | |
| using namespace std; | |
| #include "Rational.h" |
This file contains hidden or 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
| %w[ | |
| open-uri | |
| nokogiri | |
| mongo | |
| ].map { |x| require x } | |
| db = Mongo::Connection.new.db("tennis_network") | |
| Courts = db.collection("courts") | |
| Courts.create_index([["state", Mongo::ASCENDING]]) |
This file contains hidden or 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
| ☂ ~ ps aux | grep ruby | |
| deepthawtz 46543 51.7 0.2 2471504 17672 ?? S 12:38AM 3:04.06 ruby tennis_scrape.rb | |
| deepthawtz 46639 0.0 0.0 2425524 172 s003 R+ 12:44AM 0:00.00 grep ruby | |
| ☂ ~ sudo kill 46543 | |
| ☂ ~ ps aux | grep ruby | |
| deepthawtz 46543 52.0 0.2 2471504 17672 ?? S 12:38AM 3:10.20 ruby tennis_scrape.rb | |
| deepthawtz 46647 0.0 0.0 2425716 280 s003 R+ 12:44AM 0:00.00 grep ruby | |
| ☂ ~ sudo killall ruby | |
| ☂ ~ ps aux | grep ruby | |
| deepthawtz 46543 51.3 0.2 2471504 17672 ?? R 12:38AM 3:20.79 ruby tennis_scrape.rb |
This file contains hidden or 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
| var YUI = require("yui3").YUI | |
| , otherSuite = require("./other_suite") | |
| ; | |
| YUI({logInclude:{TestRunner:true}}).use("test", function(Y) { | |
| var suite = new Y.Test.Suite("Server Test Suite"); | |
| var test_nothing = new Y.Test.Case({ | |
| name: "Testing nothing", | |
| "testing nothing special": function() { |
This file contains hidden or 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
| // example runs in node.js | |
| // npm install yui3 | |
| var sys = require("sys") | |
| , YUI = require("yui3").YUI | |
| ; | |
| YUI().use("gallery-yql", function(Y) { | |
| var q = "select * from github.user.info where (id = 'deepthawtz')" | |
| , o = new Y.yql(q) |
This file contains hidden or 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
| get with it dawg |
This file contains hidden or 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
| [Fri, 17 Sep 2010 16:58:49 -0700] DEBUG: STDERR: /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/session/mem_cache_store.rb:20:in `initialize': #<ActionController::Session::MemCacheStore:0xb6cf0038> unable to find server during initialization. (RuntimeError) | |
| from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:72:in `new' | |
| from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:72:in `build' | |
| from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:116:in `build' | |
| from /home/deploy/.bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `inject' | |
| from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:116:in `each' | |
| from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:116:in `inject' | |
| from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/l |
This file contains hidden or 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 "dnapi" | |
| run "sudo cp /etc/chef/dna.json /tmp/dna.json && sudo chmod 777 /tmp/dna.json && sync" | |
| def engineyard | |
| @engineyard ||= DNApi.from(File.read("/tmp/dna.json")) | |
| end | |
| b=engineyard.environment.utility_instances.find {|x| x.name.include? "redis"} | |
| engineyard.apps.each do |app| | |
| begin | |
| run "echo host: #{b.public_hostname} > /data/#{app.name}/current/config/redis.yml" | |
| rescue |