Skip to content

Instantly share code, notes, and snippets.

View formigarafa's full-sized avatar

Rafael Santos formigarafa

View GitHub Profile
@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 / 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 / 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 / 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 / gist:4424525
Created January 1, 2013 01:20
Basic script to create a rails app encapsuled in a gemset. this script creates a gemset with the same name as the app, installs rails gem for this gemset, creates the app, add a .rvmrc and add .rvmrc into .gitignore file.
RUBY_VERSION=1.9.3
APP_NAME=that_great_app
rvm $RUBY_VERSION@$APP_NAME --create && gem install rails --no-ri --no-rdoc && rails new $APP_NAME -d mysql && echo "rvm $RUBY_VERSION@$APP_NAME" > $APP_NAME/.rvmrc && echo ".rvmrc" >> $APP_NAME/.gitignore
@formigarafa
formigarafa / bin.php
Created September 23, 2014 02:55
dúvida de matemática binária
<?php
$list_to_check = array(
array(2,2),
array(2,3),
array(3,3),
array(3,2)
);
// var_dump($list_to_check);
@formigarafa
formigarafa / file1.md
Created November 3, 2014 21:01
Gist title here, maybe a description

#whatever

you want here

@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 / Google-DNS-over-HTTPS.md
Last active March 15, 2017 08:15
Basic to get google dns over https working.
@formigarafa
formigarafa / nginx_prax_proxy.conf
Last active April 29, 2016 14:03
prax configuration with ssl via nginx. Note: remember to stop prax service (but not the daemon)
upstream prax_unsecure_backend {
server localhost:20559;
}
server {
listen 80;
server_name *.dev;
server_name *.xip.io;
server_name *.rafael.nz;