Skip to content

Instantly share code, notes, and snippets.

View SauloSilva's full-sized avatar

Saulo Santiago SauloSilva

View GitHub Profile
[
// jump between block
{"keys": ["alt+k"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}},
{"keys": ["alt+j"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true}},
{"keys": ["shift+alt+k"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true}},
{"keys": ["shift+alt+j"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true}},
// Origami
{ "keys": ["super+k", "super+w"], "command": "destroy_pane", "args": {"direction": "self"} },
@SauloSilva
SauloSilva / tmux.conf
Created December 30, 2015 05:02
tmux.conf
# Remap prefix Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
@SauloSilva
SauloSilva / Add multiple buildpacks heroku
Created December 11, 2015 03:02
Add multiple buildpacks heroku
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-nodejs.git
@SauloSilva
SauloSilva / yml_checker.yml
Created August 3, 2015 12:52
yml compare
require 'yaml'
ymls = Dir['config/locales/**/*.yml'].sort.each_slice(2).to_a
def get_keys(object)
if object.is_a? Hash
(object.keys + get_keys(object.values)).flatten.uniq
elsif object.is_a? Array
object.collect{ |value| get_keys value }
else
@SauloSilva
SauloSilva / git-clean-up
Created July 30, 2015 03:33
Git clean up
#!/bin/bash
MAIN_BRANCH=${1-master}
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git branch --merged | grep -v "\*" | grep -v $MAIN_BRANCH | grep -v dev | xargs -n 1 git branch -d
@SauloSilva
SauloSilva / git-amend
Last active August 29, 2015 14:23
git commit --amend
#!/bin/bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git add .
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git commit --amend $1
@SauloSilva
SauloSilva / dijkstra.rb
Created June 16, 2015 21:17
Algoritmo de Dijkstra
class Graph
Vertex = Struct.new(:name, :neighbours, :distance, :previous)
def initialize(graph)
@vertices = Hash.new do |key, value|
key[value] = Vertex.new(value, [], Float::INFINITY)
end
@edges = {}
@SauloSilva
SauloSilva / egg.js
Last active August 29, 2015 14:10
egg.js mini language
function parseExpression(program) {
program = skipSpace(program);
var match, expr;
if (match = /^"([^"]*)"/.exec(program))
expr = {type: "value", value: match[1]};
else if (match = /^\d+\b/.exec(program))
expr = {type: "value", value: Number(match[0])};
else if (match = /^[^\s(),"]+/.exec(program))
expr = {type: "word", name: match[0]};
else
@SauloSilva
SauloSilva / host_android.sh
Last active August 29, 2015 14:07
host android
# create file adb-hosts
192.168.0.133 adm.dev
192.168.0.133 api.clickjogos.dev
192.168.0.133 clickjogos.dev
192.168.0.133 connect.clickjogos.dev
192.168.0.133 devcenter.dev
192.168.0.133 jdm.dev
192.168.0.133 m.clickjogos.dev
192.168.0.133 sso_example.clickjogos.dev
@SauloSilva
SauloSilva / ads_tester.java
Created July 2, 2014 19:22
Ads google tester
// md5
package br.com.clickjogos.utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Md5 {
public Md5() {}
public String generate(final String s) {