Skip to content

Instantly share code, notes, and snippets.

View formigarafa's full-sized avatar

Rafael Santos formigarafa

View GitHub Profile
@formigarafa
formigarafa / weekly_edm_report.md
Last active November 26, 2015 22:06
weekly edms for week of 2015-11-23
runs sent fail total
simulated 768 1577 2345
for real 838 1584 2422
total 1606 3161 4767
@formigarafa
formigarafa / jquery.ba-tinypubsub.js
Created October 31, 2012 12:02 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@formigarafa
formigarafa / categories.rb
Created January 19, 2012 21:44
Nested categories with Active Admin
ActiveAdmin.register Category do
extend CollectiveIdea::Acts::NestedSet::Helper
form do |f|
f.inputs do
f.input :name
f.input :parent_id, :as => :select, :collection => (nested_set_options(Category, @category) {|i, level| "#{'-' * level} #{i.name}" })
end
f.buttons
end
@formigarafa
formigarafa / gist:1093256
Created July 19, 2011 17:52
Removing MySQL root password
$ mysql -u root -p
Enter password: # <= but, this will be the last time
mysql> SET PASSWORD FOR root@localhost=PASSWORD('');
Query OK, 0 rows affected (0.00 sec)
mysql> exit
bye
$ mysql -u root # with no password, cause I know what i'm doing.
@formigarafa
formigarafa / math_and_programmers.md
Created July 1, 2011 13:54 — forked from danielvlopes/gist:1057764
math and programmers

Every programming language has some kind of way of doing numbers and math. Do not worry, programmers lie frequently about being math geniuses when they really aren’t. If they were math geniuses, they would be doing math, not writing ads and social network games to steal people’s money.

@formigarafa
formigarafa / test_unit_rules.md
Created June 28, 2011 17:14 — forked from rponte/gist:1051135
A test is not a unit test if

A test is not a unit test if:

  • it talks to the database
  • it communicates across the network
  • it touches the file system
  • it can’t run at the same time as any of your other unit tests
  • you have to do special things to your environment (such as editing config files) to run it Tests that do these things aren’t bad. Often they are worth writing, and they can be written in a unit test harness. However, it is important to keep them separate from true unit tests so that we can run the unit tests quickly whenever we make changes.

--

function rake {
if [ -e Gemfile ]; then
bundle exec rake $@
else
`which rake` $@
fi
}
require 'logger'
class String
LOGGER = Logger.new($stderr)
def -@; LOGGER.info self; end
end
# Extracted earlier, hardcoded for speed
ENTITIES = %w(I-ORG O I-MISC I-PER I-LOC B-LOC B-MISC MO B-ORG)
@formigarafa
formigarafa / body.md
Created May 6, 2011 00:26
Big Bang Theory

diretor da 3M: A gente precisa melhorar as vendas destes adesivos reposicionáveis.

Marketeiro: Já falei, ninguém compra "adesivos reposicionáveis", a gente precisa de um nome bom. Um que marca, um que seja uma ordem para usar isso.

Estagiário: Isso é um conceito muito bom, posso postar isso no meu blog?

Marketeiro: Vamos chamar de Post-It, olha grande idéia essa: Post-It. Fixa, vai pegar.

Diretor da 3M: Você deu uma ótima idéia para o nome, mas eu ainda não vejo muito uso, não podemos gastar muito nessa campanha com um produto que não vai dar retorno.

@formigarafa
formigarafa / body.md
Created April 28, 2011 02:13
Primeiro Post

Primeiro Post

Inicialmente, pode parecer estranho este ser primeiro post. Mas apesar de haver conteúdo anterior a este, antes isso não era um blog. Na verdade ainda não é.

No conteúdo passado, além dos testes para fazer essa plataforma funcionar, haviam os meus outros Gists. Para quem veio direto para essa página, vale avisar. Acessando http://formigarafa.github.com será exibido a listagem dos meus Gists com as respectivas informações e seus devidos links.

Foi uma experiência bem interessante e desafiadora. Afinal todo o carregamento depende de javascript com acesso cross-domain para https://gists.github.com. Para quem tem alguma idéia do que significa cross-domain javascript já sabe o quanto isso pode ser irritante.

As principais dificuldades foram: