Skip to content

Instantly share code, notes, and snippets.

View heynemann's full-sized avatar

Bernardo Heynemann heynemann

View GitHub Profile
@heynemann
heynemann / stream.py
Created August 13, 2012 14:44
r3 sample stream
#!/usr/bin/python
# -*- coding: utf-8 -*-
from os.path import abspath, dirname, join
class CountWordsStream:
job_type = 'count-words'
group_size = 1000
def process(self, app, arguments):
@heynemann
heynemann / config.py
Created August 13, 2012 14:47
sample configuration file for r3
#!/usr/bin/python
# -*- coding: utf-8 -*-
INPUT_STREAMS = [
'my_app.stream.CountWordsStream'
]
REDUCERS = [
'my_app.reducer.CountWordsReducer'
]
@heynemann
heynemann / reducer.py
Created August 13, 2012 14:50
r3 sample reducer
#!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import defaultdict
class CountWordsReducer:
job_type = 'count-words'
def reduce(self, app, items):
word_freq = defaultdict(int)
@heynemann
heynemann / robot.js
Created November 23, 2012 15:57
test
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);
@heynemann
heynemann / robot.js
Created November 23, 2012 15:58
other
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);
@heynemann
heynemann / robot.js
Created November 26, 2012 21:24
test
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);
@heynemann
heynemann / robot.js
Created November 26, 2012 21:24
other
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);
@heynemann
heynemann / robot.js
Created November 27, 2012 01:20
test
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);
@heynemann
heynemann / robot.js
Created November 27, 2012 01:20
other
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);
@heynemann
heynemann / robot.js
Created November 27, 2012 15:56
test
//FightCode can only understand your robot
//if its class is called robotClass
var robotClass = function(){
};
robotClass.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
robot.rotateCannon(360);