Skip to content

Instantly share code, notes, and snippets.

View klebervirgilio's full-sized avatar
🎯
Focusing

Kleber Correia klebervirgilio

🎯
Focusing
View GitHub Profile
@klebervirgilio
klebervirgilio / clear_float.css
Last active December 15, 2015 12:29
CSS - clear float
/* clearfix */
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling
Hirb::View.instance_eval do
def enable_output_method
@klebervirgilio
klebervirgilio / .pryrc
Created March 26, 2013 12:55
My Methods
class Object
def _mm
case self.class
when Class
self.public_methods.sort - Object.public_methods
when Module
self.public_methods.sort - Module.public_methods
else
self.public_methods.sort - Object.new.public_methods
end
@klebervirgilio
klebervirgilio / gist:5102265
Created March 6, 2013 19:28
HEROKU RESTORE FROM PROD
heroku pgbackups:restore HEROKU_POSTGRESQL_RED_URL `heroku pgbackups:url --remote heroku` --remote staging
@klebervirgilio
klebervirgilio / gist:5093575
Created March 5, 2013 19:47
POSTGRES DUMP
PGPASSWORD='secret' /usr/bin/pg_dump --username='username' --host='localhost' --port='5432' -xc -E=utf8 database >> dump.sql
// Good this will only be called again once findFoo has completed.
;(function main() {
findFoo();
setTimeout(main, 100);
})();
cd /tmp
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
git checkout v`git --version | awk '{print $3}'`
cp contrib/completion/git-completion.bash ~/.git-completion.bash
cd ~
rm -rf /tmp/git
echo -e "source ~/.git-completion.bash" >> .profile
be rake db:migrate:down VERSION=$(ruby -e 'print Dir["./db/migrate/**"].last.match(/\/(?<s>\d+)/)[:s]')
function add_alias {
echo "alias $1=\"$2\"" >> ~/.aliases
echo 'Reloading...'
sz
}
function show_my_aliases {
echo $my_aliases | sort | grep -e "^$" -v
}
@klebervirgilio
klebervirgilio / gist:4737410
Created February 8, 2013 08:16
Load a mysql database to a local database.
function load_remote_mysql_data{
ssh '$user@$server' mysqldump $mrdb -u$mru -p$mrp | mysql $mldb -u$mlu -p$mlp
echo 'done!'
}