Skip to content

Instantly share code, notes, and snippets.

View SauloSilva's full-sized avatar

Saulo Santiago SauloSilva

View GitHub Profile
@SauloSilva
SauloSilva / clojure_get_started.md
Last active May 30, 2016 04:33
Clojure Get Started

listas

São simples

'(1 2 3)

Vetores

@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 / skype_hint.txt
Created April 11, 2016 13:48
open more than one skype
open -na /Applications/Skype.app --args -DataPath /Users/$(whoami)/Library/Application\ Support/Skype2
do (Backbone) ->
method =
cacheOrFetch: (options={}) ->
@_cache ?= @fetch(options)
_.extend(Backbone.Collection.prototype, method)
@SauloSilva
SauloSilva / to_sentence.coffee
Created January 25, 2014 20:36
Clone to setence active support of rails.
Array.prototype.toSentence = ->
wordsConnector = ', '
lastWordConnector = ' e '
sentence = undefined
switch @length
when 0
sentence = ''
when 1
sentence = @[0]
@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 / Preferences.sublime-settings
Created December 30, 2015 05:54
sublime preferences
{
"auto_complete": false,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 0,
"bold_folder_labels": true,
"caret_extra_width": 5,
"gpu_window_buffer": true,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": false,
[
// 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 / scale.js
Created November 12, 2013 16:38
scale element
window.scaler = function(options) {
var a, ab, b, c, cd, d, e, f, scale;
a = options.srcWidth;
b = options.srcHeight;
c = options.windowWidth;
d = options.windowHeight;
console.log(c, d);
ab = a / b;
cd = c / b;
e = 0;
@SauloSilva
SauloSilva / split.coffee
Created October 2, 2013 04:02
split array in js. Ex: [1,2,3,4,5,6,7] by 2 transform to [[1,2], [3,4], [5,6], [7]]
split = (array, numberOf) ->
matrix = []
indice = 0
aux = -1
while indice < array.length
if indice % numberOf is 0
aux++
matrix[aux] = []
matrix[aux].push array[indice]