Skip to content

Instantly share code, notes, and snippets.

==== limpar resque
Resque::Failure.count
a = Resque::Failure.all(0,50); nil
lista = []
a.each_with_index do |x,i|
if x['payload']['args'].first['queue_name'] == 'salary_stub_load_job'
lista << i
end
let profilesIntoConversation = this.get('currentProfile.conversations').reduce((profilesByConversation, currentConversation) => {
profilesByConversation.push({
conversation: currentConversation,
profiles: currentConversation.get('participants').filter((participant) => {
return (this.removeAccents(participant.get('name').toLowerCase()).indexOf(filter) !== -1
|| participant.get('phone').indexOf(filter) !== -1)
&& participant.get('remotoAddress') !== this.get('currentProfile.remotoAddress');
})
});
return profilesByConversation;
@brunopedroso
brunopedroso / robot.js
Created December 13, 2012 19:51 — forked from jaskolek/robot.js
jaskolek
var robots = new Array();
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.start = function( ev ){
@brunopedroso
brunopedroso / robot.js
Created December 6, 2012 19:55
DOJOBOT
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
this.state = 'procurando';
this.voltadas = 0
};
Robot.prototype.onIdle = function(ev) {
//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);
@brunopedroso
brunopedroso / core.clj
Created June 17, 2012 23:07
ArgsKata from a Clojure newbie
(ns args_kata.core)
(def default-values {
Boolean false
String ""
Integer 0
})
(defn convert-value [type value]
(condp = type
int qtdFrames = qtdBolas/2 + qtdBolas%2;
for(frame = 0; frame < qtdFrames; frame++){
int indiceBola1 = frame*2;
//terceira bola do ultimo frame
if (frame == 10) {
return resultado;
}
for(i = 0; i < tamanho; i++){
frame ++;
//terceira bola do ultimo frame
if (frame == 11) {
return resultado;
}
//verifica se o frame esta completo
if((i+1 < tamanho)) {
void TesteNaoConsideraLixoFimArray(CuTest *tc) {
int arrayJogadas[6] = {9,1,1,0,10,10};
//quantidade jogadas(qtdJogadas) menor que arrayJogadas. Nao deve somar os 10`s
int qtdJogadas = 4;
CuAssertIntEquals(tc,12,calcularResultadoInteiros(arrayJogadas,qtdJogadas));
}
int calcularResultado(char *linha) {
int arrayJogadas[21];
int tamanho = getJogadas(linha,arrayJogadas);
return calcularResultadoInteiros(arrayJogadas, tamanho);
}