Skip to content

Instantly share code, notes, and snippets.

View shingara's full-sized avatar

Cyril Mougel shingara

  • regate.io
  • Pau ( France )
View GitHub Profile
@shingara
shingara / robot.js
Created December 7, 2012 15:28 — forked from Klaudiusz-Borowiak/robot.js
P3exp
var robotSpotted = false;
var lastKnownX = -1;
var lastKnownY = -1;
var Robot = function(robot) {
//robot.clone();
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
@shingara
shingara / robot.js
Created December 7, 2012 15:26 — forked from glanau/robot.js
THE destroyer
//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);
@shingara
shingara / robot.js
Created December 7, 2012 15:25 — forked from baptistedeleplace/robot.js
GunpowderBot
//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);
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
# 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"
#!/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))}
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)