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
var restify = require('restify'); | |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/spike'); | |
var db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error:')); | |
db.once('open', function() { | |
console.log('yay'); | |
}); |
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
[alias] | |
# keep working (it opens current changed files) | |
kw = !git status --porcelain --ignore-submodules | awk '$1 != "D" { print $2}' | xargs $EDITOR | |
# previous work (it opens changed files from previous commit) | |
pw = !git log -1 --raw | grep ^: | awk '$5 != "D" { print $6}' | xargs $EDITOR |
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
zero = \s z -> z | |
one = λs z -> s z | |
two = λs z -> (s . s) z | |
arabic = \n -> n + 1 | |
pipes = \n -> n ++ "|" | |
--two arabic 0 | |
-- 2 |
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
:t True | |
True :: Bool | |
:t 1 | |
1 :: Num a => a | |
:t [(1.2, "b", 'c'), (2.3, "d", 'e')] | |
[(1.2,"b",'c'),(2.3,"d",'e')] :: Fractional a => [(a,[Char],Char)] | |
inc :: Num a => a -> a |
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
<p>A realização do evento “Colóquio Internacional de Justiça Juvenil na Contemporaneidade”, no ano de 2014, resultou em uma experiência extremamente <strong>positiva</strong> no campo da socioeducação, tanto em relação às práticas profissionais, bem como na discussão acadêmica.</p>\r\n\r\n<p>A partir dos debates e das trocas realizadas no âmbito do evento, foi possível estender a interlocução entre quem vivencia, estuda ou trabalha com a temática. Observamos que agentes universitários(as), técnicos(as) e professores(as) têm se constituído em importantes interlocutores e interlocutoras junto às pessoas que operam o sistema socioeducativo, tornando-se, muitas vezes, referência técnica na área.</p>\r\n\r\n<p>Todavia, há uma necessidade de diálogo mais aprofundado entre quem trabalha cotidianamente com essa tem&aa |
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
import re | |
import sys | |
#example 10.223.157.186 - - [15/Jul/2009:15:50:35 -0700] "GET /assets/js/lowpro.js HTTP/1.1" 200 10469 | |
pattern = re.compile(r'"(?P<method>.+)\s+(?P<path>.+)\s+(?P<protocol>.+)"\s+(?P<status>\S+)') | |
for line in sys.stdin: | |
matches = pattern.match(line) | |
result = matches.groupdict() | |
print "{0}\t{1}".format(result["path"], result["status"]) |
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
Ruby 1.9.3-p448 | |
http://rubyinstaller.org/downloads/ | |
durante a instalação marcar a opção para adicionar os executáveis Ruby ao PATH: http://simplesideias.com.br/media/ruby-win/ruby-installer-configuration.png | |
Devkit | |
http://rubyinstaller.org/downloads/ | |
DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe | |
Extrair o conteúdo em alguma pasta, de preferência chamada 'devkit' e utilizando o 'Start Command Prompt with Ruby' executar: | |
ruby dk.rb init | |
ruby dk.rb install | |
gem install gosu |
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 Asteroid | |
attr_reader :x, :y | |
def initialize(game) | |
@sprite = Gosu::Image.load_tiles(game, "images/asteroids.png", 320/5, 384/6, true) | |
@x, @y = 100, 100 | |
end | |
def update | |
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
class Plane | |
def initialize(game) | |
@x = 100 | |
@y = 100 | |
@sprite = Gosu::Image.load_tiles(game, "images/planes.png", 66, 67, true)[0..2] | |
end | |
def draw | |
@sprite[Gosu::milliseconds / 100 % @sprite.size].draw_rot(@x, @y, 1, 0) | |
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
# Para cada sabor de pizza disponível, cada um deve indicar uma nota para ele (nota 1, se a pessoa detesta o sabor e nota 5 se a pessoa adora o sabor). Depois de processar esses dados, cada pessoa vai saber quais as pessoas que tem o gosto mais parecido que o seu (e que provavelmente irá dividir uma pizza com você). | |
# Por exemplo, para os dados a seguir, o Luca gostaria de saber quem ele deve convidar para dividir uma pizza com ele: | |
Renato = { Marguerita: 4, QuatroQueijos: 5, Escarola: 4, Portuguesa: 5, FrangoCatupiry: 4, Napolitana: 3 } | |
Marcelo = { Marguerita: 2, Quatroqueijos: 2, Escarola: 1, Portuguesa: 3, FrangoCatupiry: 5, Napolitana: 2 } | |
Lenon = { Marguerita: 4, Quatroqueijos: 5, Escarola: 2, Portuguesa: 1, FrangoCatupiry: 1, Napolitana: 3 } | |
Renata = { Marguerita: 4, Quatroqueijos: 5, Escarola: 1, Portuguesa: 1, FrangoCatupiry: 3, Napolitana: 4 } | |
Washington = { Marguerita: 1, Quatroqueijos: 1, Escarola: 2, Portuguesa: 3, FrangoCatupiry: 4, Napolitana: 3 } | |
Tino = { Marguerita: 1, Quatroqueijos: 5, Escar |