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 / ssh_config
Created April 4, 2019 18:25
Using multiple ssh keys with git
# This gist will help you using multiple github or bitbucket accounts in the same machine.
# 1. create a .ssh/config file, with this content:
# use "bitbucket-ieducativa" as git remote host, to use this custom key
Host bitbucket-ieducativa
HostName bitbucket.org
User git
IdentityFile ~/.ssh/bitbucket-ieducativa
IdentitiesOnly yes
@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)');
}
@lucasdavila
lucasdavila / routes-group_user.js
Last active August 29, 2015 14:21
Backbone.js router testing
/*global define*/
define([
'routes/base',
'jquery',
'views/group_users'
], function (BaseRouter, $, GroupUsersView) {
'use strict';
var GroupUserRouter = BaseRouter.extend({
@lucasdavila
lucasdavila / ffmpeg.sh
Last active August 29, 2015 14:12
Export video thumbnail with ffmpeg
ffmpeg -itsoffset -7 -i video.mov -vcodec mjpeg -f rawvideo -s 624x416 image.jpg
@lucasdavila
lucasdavila / fixup.txt
Last active December 20, 2023 12:00
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf
@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 / 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

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