Skip to content

Instantly share code, notes, and snippets.

namespace :foo do
task :a do
exec "echo A"
end
task :b => [:'foo:a'] do
exec "echo B"
end
@cv
cv / graceful_degradation_helper.rb
Created June 29, 2011 21:02
a graceful degradation helper for dangerous operations in the template
module GracefulDegradationHelper
# doctest:
#
# >> gracefully { tag(:hello) }
# => "<hello />"
#
# >> gracefully { raise "oops" }
# => ""
#
require 'rubygems'
require 'rspec'
module EventLogging
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
tw@hernan-cortes:~$ [master*] time rake jasmine:headless
....................................
PASS: 36 tests, 0 failures, 0.175 secs.
real 0m4.303s
user 0m2.660s
sys 0m0.900s
++ pwd
+ PWD=/var/lib/go-agent/pipelines/profiles/tmp/rpmbuild/BUILD/profiles
+ env -i GEM_HOME=/var/lib/go-agent/pipelines/profiles/tmp/rpmbuild/BUILD/profiles/vendor/bundle/ruby/1.9.1 GEM_PATH=/var/lib/go-agent/pipelines/profiles/tmp/rpmbuild/BUILD/profiles/vendor/bundle/ruby/1.9.1 gem install bundler --no-rdoc --no-ri
ERROR: Could not find a valid gem 'bundler' (>= 0) in any repository
ERROR: Possible alternatives: bundler
error: Bad exit status from /var/tmp/rpm-tmp.23649 (%build)
Bad exit status from /var/tmp/rpm-tmp.23649 (%build)
*.sw?
tags
git config --global github.password 'security find-internet-password -wgs github.com # 2>&1 >/dev/null find-internet-password -wgs github.com'
@cv
cv / robot.js
Created December 5, 2012 22:45 — forked from fabiopimentel/robot.js
[CAELUM TEAM]Megatron
//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.clone();
@cv
cv / array-listeners.js
Created January 12, 2015 21:55
array-listeners.js
Array.prototype.addEventListener = function(fn, cb) {
if(!this.__eventListeners) {
this.__eventListeners = {};
}
if(typeof(fn) !== 'string') {
throw "Can't add event listener: 1st argument is not a string";
}
if(typeof(cb) !== 'function') {
@cv
cv / auxílio-doença.xml
Created February 17, 2015 03:44
Exemplo de XML de serviço (legado)
<?xml version="1.0" encoding="UTF-8"?>
<servico>
<titulo>Auxílio-Doença</titulo>
<descricao>Benefício concedido ao segurado impedido de trabalhar por doença ou acidente por mais de 15 dias
consecutivos. No caso dos trabalhadores com carteira assinada, os primeiros 15 dias são pagos pelo empregador,
exceto o doméstico, e a Previdência Social paga a partir do 16º dia de afastamento do trabalho. Para os demais
segurados inclusive o doméstico, a Previdência paga o auxílio desde o início da incapacidade e enquanto a mesma
perdurar.
</descricao>
<requisitos></requisitos>