Skip to content

Instantly share code, notes, and snippets.

View vitormil's full-sized avatar

Vitor Oliveira vitormil

View GitHub Profile
@vitormil
vitormil / pad.js
Last active August 29, 2015 14:21
pads the side of a string with a specific set of characters
function pad (text, padded_length, pad_string, pad_direction) {
pad_string = pad_string || " ";
text = text + "";
if (text.length >= padded_length) {
return text;
}
var pad_content = new Array(padded_length - text.length + 1).join(pad_string);
if (!pad_direction || pad_direction === "left") {
return pad_content + text;
} else {
@vitormil
vitormil / rails http status codes
Created May 10, 2016 14:47 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@vitormil
vitormil / .profile
Created June 23, 2016 21:46 — forked from sindresorhus/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@vitormil
vitormil / swap_lines.vim
Last active July 13, 2016 17:16
~/.vim/plugin/swap_lines.vim
function! s:swap_lines(n1, n2)
let line1 = getline(a:n1)
let line2 = getline(a:n2)
call setline(a:n1, line2)
call setline(a:n2, line1)
endfunction
function! s:swap_up()
let n = line('.')
if n == 1
@vitormil
vitormil / swap_lines.vim
Created November 28, 2016 17:41
swap_lines.vim
function! s:swap_lines(n1, n2)
let line1 = getline(a:n1)
let line2 = getline(a:n2)
call setline(a:n1, line2)
call setline(a:n2, line1)
endfunction
function! s:swap_up()
let n = line('.')
if n == 1
export ZSH=/home/voliveira/.oh-my-zsh
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status node_version time)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=" \n "
POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX=" $ "
POWERLEVEL9K_NODE_VERSION_FOREGROUND='008'
@vitormil
vitormil / vscode-extensions.txt
Last active August 22, 2020 20:54
visual code settings
# CLI:
# code --list-extensions > ~/tmp/vscode-extensions.txt
# code --install-extension <name>
adpyke.codesnap
angryobject.react-pure-to-class-vscode
artdiniz.quitcontrol-vscode
aslamanver.vsc-export
bierner.markdown-preview-github-styles
BriteSnow.vscode-toggle-quotes
@vitormil
vitormil / dockercomplete.sh
Created January 7, 2021 22:08
docker zsh autocomplete (for macOS)
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.zsh-completion /usr/local/share/zsh/site-functions/_docker
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.zsh-completion /usr/local/share/zsh/site-functions/_docker-compose
echo "autoload -Uz compinit; compinit" >> .zshrc
@vitormil
vitormil / Gemfile
Created March 7, 2021 15:03 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@vitormil
vitormil / keyboard.sh
Last active March 14, 2021 14:18
How to increase keyboard key repeat rate on OS X?
defaults write -g ApplePressAndHoldEnabled -bool false
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)