Skip to content

Instantly share code, notes, and snippets.

View vitormil's full-sized avatar

Vitor Oliveira vitormil

View GitHub Profile
@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
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 / 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
@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 / .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 / 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 / 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 / metadata.json
Created May 26, 2014 03:17
Parse error - fb:admins property
{ "Content-Encoding":"UTF-8",
"Content-Length":77289,
"Content-Type":"application/xhtml+xml",
"HandheldFriendly":"True",
"MobileOptimized":320,
"X-UA-Compatible":"IE\u003dEdge",
"apple-mobile-web-app-title":"TechCrunch",
"application-name":"TechCrunch",
"article:publisher":"https://www.facebook.com/techcrunch",
"cleartype":"on",
@vitormil
vitormil / myapp-web.conf
Last active December 30, 2015 17:19
/etc/init/<file>.conf
description "Myapp web application"
start on starting myapp
stop on stopping myapp
respawn
exec su - myapp -c 'cd /var/www/myapp/current/ && bundle exec unicorn -c ./config/unicorn.rb --env production >> /var/log/myapp/web.log 2>&1'
@vitormil
vitormil / myappname.conf
Last active December 30, 2015 15:59
/etc/nginx/cond.d/myappname.conf
upstream myappname {
server unix:/var/run/myappname/web.sock fail_timeout=0;
}
server {
server_name .oldappname.com;
rewrite ^ http://myappname.com$request_uri? permanent;
}
server {