Skip to content

Instantly share code, notes, and snippets.

View lucasdavila's full-sized avatar
🌈

Lucas D'Avila lucasdavila

🌈
  • SC, Brasil
View GitHub Profile
@lucasdavila
lucasdavila / setup.sh
Last active March 20, 2017 11:25 — forked from erwanjegouzo/gist:5903791
Dropbox preferences sync
# bash_profile
mv ~/.bash_profile ~/Dropbox/.bash_profile
ln -s ~/Dropbox/.bash_profile ~/.bash_profile
# Sublime 2 Preferences
mkdir -p ~/Dropbox/Library/Application\ Support/Sublime\ Text\ 2/
cd ~/Library/Application\ Support/Sublime\ Text\ 2/
mv ./Installed\ Packages ~/Dropbox/Library/Application\ Support/Sublime\ Text\ 2/Installed\ Packages
mv ./Packages ~/Dropbox/Library/Application\ Support/Sublime\ Text\ 2/Packages
mv ./Pristine\ Packages ~/Dropbox/Library/Application\ Support/Sublime\ Text\ 2/Pristine\ Packages
@lucasdavila
lucasdavila / reverse-port-tunneling.sh
Created October 22, 2013 10:59
reverse port tunneling
echo "to reverse ssh, partner can run: ssh -nNT -R 2201:localhost:22 lucasdavila@remote-server -p 2200"
ssh -nNT -R 2200:localhost:22 lucasdavila@remote-server
@lucasdavila
lucasdavila / fix-middle-alignment.js
Created December 24, 2015 15:10
Fix middle alignment
function fixMiddleAlignment() {
var header = $('.middle.aligned'),
halfOfHeight = header.height() / 2;
header.css('position', 'relative');
header.css('top', 'calc(50% - ' + halfOfHeight + 'px)');
}

Capybara

save_and_open_page

Matchers

have_button(locator)
" RSpec
map <Leader>r :call RunTest()<CR>
map <Leader>R :call RunNearestTest()<CR>
function! RunTest()
call RunTestFile(FindTestFile())
endfunction
function! RunNearestTest()
call RunTestFile(FindTestFile() . ':' . line('.'))
@lucasdavila
lucasdavila / 1_ambiente_desenvolvimento.sh
Last active December 12, 2015 03:59
Instalação i-Educar
echo -e "\n\n** Atualizando apt-get"
sudo apt-get update -y
echo -e "\n\n** Instalando git"
sudo apt-get install -y git-core
echo -e "\n\n** Instalando apache e mod_rewrite"
sudo apt-get install -y apache2
sudo a2enmod rewrite
sudo service apache2 restart
@lucasdavila
lucasdavila / lazy_fixtures.rake
Created January 12, 2013 17:49
Dumps database records into test fixtures.
namespace :db do
namespace :fixtures do
# by default it task load records from development env,
# to change send the RAILS_ENV var, eg: $ rake db:fixtures:dumps RAILS_ENV=production
desc 'dumps the database data into test fixtures.'
task :dumps => :environment do
sql = "SELECT * FROM %s"
skip_tables = ['schema_info', 'schema_migrations']
@lucasdavila
lucasdavila / sending_email_in_gae_using_web2py_mail_api.py
Created May 28, 2011 13:02
Sending email in GAE using web2py Mail API
"""
a alguns dias acompanhei pela lista brasileira do Web2py que alguns usuários estavam
com dificuldades com envio de email no GAE, hoje passei por isso :( segue dica para
quem também estiver com dificuldades no envio de email pelo GAE.
Em um modelo ex: "models/db.py" inclua o código abaixo:
"""
from gluon.tools import Mail
@lucasdavila
lucasdavila / force_dropdb
Created November 22, 2012 16:22
Force postgresql dropdb without restarting
# first get the ids from the process that still connected to db
$ psql -d db_name -c "select procpid from pg_stat_activity where datname='db_name' and waiting is not false;"
# after, kill the process that still connected to db
$ kill procpid_returned_from_query
$ dropdb db_name
@lucasdavila
lucasdavila / pt-BR.yml
Created November 20, 2012 19:55
i18n for simple_form labels and placeholders
# rails_app/config/locales/pt-BR.yml
'pt-BR':
simple_form:
labels:
form_name:
name: 'Nome'
city: 'Cidade'
placeholders: