This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
" Vundle configuration | |
"====================== | |
filetype off | |
filetype plugin indent on | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModel < ActiveRecord::Base | |
after_initialize :token_default_value | |
private | |
def token_default_value | |
self.token ||= UUID.new.generate | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, List<Pessoa>> pessoasPorCarro = new LinkedHashMap<String, List<Pessoa>>(); | |
//para cada carro da pessoa | |
for (String carro : pessoa.getCarros()) { | |
//verificar se alguma outra pessoa possui esse carro | |
for (Pessoa outraPessoa : pessoas) { | |
if(pessoa.equals(outraPessoa)) continue; | |
for (String outroCarro : outraPessoa.getCarros()) { | |
if (carro.equals(outroCarro)) { | |
if (pessoasPorCarro.get(carro) == null) pessoasPorCarro.put(carro,new ArrayList<Pessoa>()); | |
pessoasPorCarro.get(carro).add(outraPessoa); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.apache.commons.collections.ListUtils.intersection(pessoa.getCarros(), outraPessoa.getCarros()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pessoas_por_carro = Hash.new{|h, k| h[k] = []} | |
pessoas.each do |outra_pessoa| | |
carros_em_comum = pessoa.carros & outra_pessoa.carros | |
carros_em_comum.each do |carro| | |
pessoas_por_carro[carro] << outra_pessoa | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Pre-requisites | |
apt-get -y update | |
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev | |
# Download and compile Ruby 2.0.0-p0 | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz | |
tar -xvzf ruby-2.0.0-p0.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
def initialize(param1, *param2, param3, param4: '', param5: nil) | |
end | |
end | |
params = Test.instance_method(:initialize).parameters | |
puts params.inspect | |
# => [[:req, :param1], | |
# [:rest, :param2], | |
# [:req, :param3], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PipeSource | |
def initialize(stream) | |
@stream = stream | |
@head_lambda = ->(it) { it } | |
end | |
def |(lambd) | |
temp = @head_lambda | |
@head_lambda = ->(it) do | |
lambd.call(temp.call(it)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Synthetizer | |
def initialize | |
@heap = [] | |
end | |
def push(element) | |
@heap << element | |
end | |
def synth(sexp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# General | |
# set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
set -g base-index 1 | |
set -g pane-base-index 1 | |
set -g prefix C-a | |
set -s escape-time 0 | |
set -g set-titles on | |
set -g mode-keys vi | |
#set -g set-titles-string ' #(__git_ps1) ' | |
set -g status-interval 2 |
OlderNewer