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 robotSpotted = false; | |
var lastKnownX = -1; | |
var lastKnownY = -1; | |
var Robot = function(robot) { | |
//robot.clone(); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; |
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
//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.rotateCannon(360); | |
robot.ahead(50); | |
robot.turn(30); |
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
//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(50); |
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
class User < ActiveRecord::Base | |
def comments | |
Post.where('comments.user_id' => self.id).all.select {|post| | |
post.comments.select{|c| c.user_id == self.id} | |
}.flatten.uniq | |
end | |
end | |
class Post | |
include Mongoid::Document |
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
# mongo_template.rb | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# fork of Kyle Banker's Rails MongoMapper Template (http://gist.github.com/219223) | |
# | |
# To use: | |
# change url by raw link in http://gist.github.com/242007 | |
# rails project_name -m http://gist.github.com/gists/242007.txt | |
# remove unneeded defaults | |
run "rm public/index.html" |
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
#!/usr/bin/env ruby | |
%w[rubygems sinatra jsmin cssmin].each{|l| require l} | |
configure :development do | |
set :js_proc, proc {|f| "\n/* '#{f}' */\n" + File.read(f)} | |
set :css_proc, proc {|f| "\n/* '#{f}' */\n" +File.read(f)} | |
end | |
configure :production do | |
set :js_proc, | |
proc{|f|"/* '#{File.basename(f)}' */\n" + JSMin.minify(File.read(f))} |
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
describe 'handle 2 DNS NOTIFY message' do | |
before(:each) do | |
Multilog::SlaveZones.any_instance.expects(:authorized?).returns(true).twice | |
stdout_file = File.open(File.join(@test_root, 'stdout.log'), 'w+') | |
IO.expects(:popen).with('multilog t ./main', 'w').returns(stdout_file) | |
STDIN.expects(:gets).times(4).returns(*TINYDNS_LOG_SAMPLE[3..5]).then.returns(false) | |
Multilog::App.any_instance.expects(:system).times(4) |