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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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
var connStr = process.env.MONGOHQ_URL; | |
var config = { | |
name: 'database_name', | |
host: 'localhost', | |
port: 27017, | |
opts: {auto_reconnect: true} | |
}; | |
if (connStr) { | |
var url = require('url'); |
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
; Weekly Coding Challenge 22 @ ThoughtWorks Brazil | |
; | |
; For a given set, find all subsets which the sum | |
; of its members is the closest smaller value to a | |
; given number | |
; | |
(ns tw.wcc | |
(:use [clojure.contrib.combinatorics])) |
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
[ | |
["1298302885", "1100"], | |
["1298907685"], | |
["1299512485", "1100"], | |
["1300117285", "1000"], | |
["1300722085", "1100"], | |
["1301326885", "1100"], | |
["1301931685"], | |
["1302536485", "1100"], | |
["1303141285", "1000"], |
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
<a href="http://desconf.org/"><img alt="EU VOU na desconf!" src="http://posterous.com/getfile/files.posterous.com/desconf/3B6GXqJJ1yeidq4ctDCK2jaHfp8JICDwXLP1puzqhmTKCHl7hsy8g3IJBkmP/image001.png" width="150" height="168"></a> |
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
## | |
# odd difference between Ruby's AND comparison operators: '&&' and 'and' | |
## | |
# with '&&' it will throw an error expecting 'end' after params.include? | |
if request.post? && request.params.include? 'post_param' then | |
end | |
# with 'and' it will work fine and you'll call the day for a beer | |
if request.post? and request.params.include? 'post_param' then |
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
$ sudo ln -s /usr/lib/ruby/gems/1.9.1/gems/rack-test-0.5.4/ /var/lib/gems/1.9.1/gems/ |
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
$ gem which rack | |
/var/lib/gems/1.9.1/gems/rack-1.2.1/lib/rack.rb | |
$ gem which rack/test | |
/usr/lib/ruby/gems/1.9.1/gems/rack-test-0.5.4/lib/rack/test.rb |
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
$ touch test.rb | |
$ echo "require 'rack/test'" >> test.rb | |
$ ruby test.rb |
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
$ sudo gem install rack-test |