Skip to content

Instantly share code, notes, and snippets.

@renanivo
renanivo / .vimrc
Last active September 5, 2015 01:25
My .vimrc
" Import dotVIM (https://github.com/renanivo/dotvim)
source ~/.vim/vimrc
" Usability {{{
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set foldmethod=marker
PS1='\[\033[38m\]\u@\h\[\033[01;34m\] \w \[\033[31m\]`git branch 2>/dev/null | grep \* | head -1 | sed "s/\* //g" | awk "{ print \"(\"\\\$1 \")\" }"`\n\[\033[29m\]$\[\033[00m\] '
@renanivo
renanivo / neocomplcache-keymaps.vim
Created April 17, 2012 15:36
use tabs in vim's neocomplcache plugin
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplcache#close_popup()
inoremap <expr><C-e> neocomplcache#cancel_popup()
@renanivo
renanivo / gist:3250346
Created August 3, 2012 18:45
get the hash of the last commit of a <file>
git log --format="%h" -n 1 <file>
@renanivo
renanivo / .vimrc
Created November 1, 2012 21:36
example of auto test with MakeGreen
let g:makegreen_stay_on_file = 1 " do not jump to the test file on errors
autocmd BufNewFile,BufRead *.py compiler nose
autocmd BufWritePost *.py MakeGreen -c nose.cfg
@renanivo
renanivo / delete-merged.sh
Last active December 13, 2015 23:09
delete local merged branches
#!/bin/bash
#usage:
# ./delete-merged.sh ignored_branch1 ignored_branch2 ignored_branch3 ...
FILTER="master\|integra"
for i in "$@"; do
FILTER+="\|$i"
done
git branch --merged | gsed "/$FILTER/d" | gsed 's/\*//' | gsed 's/^/git branch -D/' | sh
@renanivo
renanivo / ctags.patch
Created October 22, 2013 15:19
ctags dev patch
diff --git a/Library/Formula/ctags.rb b/Library/Formula/ctags.rb
index 87dd0ca..9e44c23 100644
--- a/Library/Formula/ctags.rb
+++ b/Library/Formula/ctags.rb
@@ -6,7 +6,7 @@ class Ctags < Formula
sha1 '482da1ecd182ab39bbdc09f2f02c9fba8cd20030'
head do
- url 'https://ctags.svn.sourceforge.net/svnroot/ctags/trunk'
+ url 'https://svn.code.sf.net/p/ctags/code/trunk'

Legendas Clean Code

  • Organização do GitHub: Friends of Clean Code (clean-code-subtitles)
  • S/ lista de discução tag no github da issue
  • Usar repositório existente
    • Não, do zero
  • Repositório todo em inglês, mas pode-se usar português se necessário (dúvidas de gramática, tradução, etc)
    • tag para pt-BR nestes casos
  • mandar email p/ Uncle Bob e perguntar do transcript
@renanivo
renanivo / pre-commit.sh
Created March 6, 2015 20:20
Pre-commit script to avoid an empty commit
LIST_MODIFIED=$(git diff-index --name-status --cached HEAD | grep -w '^.*$' | sed 's/^.\{2\}//')
if [ ${#LIST_MODIFIED[@]} -eq 0 ]; then
echo "\033[33mNothing to commit, genius!\033[39m""]]"
exit 1
fi
@renanivo
renanivo / asyncio.py
Created January 1, 2016 03:34
First steps with prompt toolkit (Python 3)
import asyncio
from prompt_toolkit.shortcuts import prompt_async
@asyncio.coroutine
def my_coroutine():
while True:
result = yield from prompt_async('Say something: ', patch_stdout=True)
print('You said: %s' % result)