Skip to content

Instantly share code, notes, and snippets.

a = [6, 2, 8, 4, 7]
# 2 numeros corretos, 1 na posição certa
b = [0, 5, 9, 4, 7]
# 2 números corretos, mas na posição errada
c = [1, 3, 0, 8, 7]
# 1 número correto na posição correta
d = [9, 7, 6, 3, 2]
@joaohornburg
joaohornburg / stop_services_to_install_docker.sh
Created July 4, 2016 17:04
stop_services_to_install_docker
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
@joaohornburg
joaohornburg / standard_deviation.rb
Created October 17, 2014 16:36
Standard deviation
module Enumerable
def sum
self.inject(:+)
end
def mean
self.sum/self.length.to_f
end
require 'net/http'
module Net
class HTTP
def self.enable_debug!
# raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development'
class << self
alias_method :__new__, :new
def new(*args, &blk)
instance = __new__(*args, &blk)
instance.set_debug_output($stderr)
@joaohornburg
joaohornburg / recrutamento.js
Created June 11, 2013 20:08
Para colocar em páginas de recrutamento
$("form").submit(function() {
if($.browser.msie){
alert("Você foi desqualificado");
return false;
}
}