Skip to content

Instantly share code, notes, and snippets.

View vinibaggio's full-sized avatar

Vinicius Baggio Fuentes vinibaggio

View GitHub Profile
@vinibaggio
vinibaggio / gist:2472759
Created April 23, 2012 18:03
Loja do vinibaggio

Loja do @vinibaggio

Vou vender minhas coisas pois estou de mudança e vou aproveitar pra limpar os armarios! Estou aberto à negociação! Mande seu item de interesse e sua proposta pra [email protected]. Fotos também sob demanda.

Promoção de encerramento, 15% de desconto em tudo! Pedidos com envio por sedex apenas até hoje as 14h.

Tech

(1..10).each do |i|
puts i if i==3..i==5
end
# 3
# 4
# 5
class FacebookUser
def initialize(data)
@uid = data.uid
@first_name = data.info.first_name
@last_name = data.info.last_name
@email = data.info.email
@image = data.info.image
@urls = data.info.urls['Facebook']
@token = data.credentials.token
end
@vinibaggio
vinibaggio / gist:2952295
Created June 19, 2012 04:34
Validação de emails pela RFC
# Original: http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
function Car() {
this.wheels = arguments[0];
this.type = arguments[1];
}
function SportsCar() {
this.speed = arguments[0];
}
SportsCar.prototype = new Car();
@vinibaggio
vinibaggio / gist:3925634
Created October 21, 2012 03:59
Example of pattern matching in scala
// Pattern matching <3
scala> val X = 'b'
X: Char = b
scala> val List(_, (X, x)) = List(('a', 1), ('b', 2))
x: Int = 2
@vinibaggio
vinibaggio / gist:5670821
Created May 29, 2013 14:44
Diferença visual entre callbacks e promises
// Callbacks
ObjController.prototype.update = function (req, res) {
model.save(function (err, object) {
if(err) req.render500(err)
otherModel.update(req.form, function (err, object) {
if(err) req.render500(err)
req.render('obj')
})
})
@vinibaggio
vinibaggio / rails.pt.yml
Created April 28, 2014 06:17
Arquivo de localização do Rails para português brasileiro.
pt:
date:
abbr_day_names:
- Dom
- Seg
- Ter
- Qua
- Qui
- Sex
- Sáb
@vinibaggio
vinibaggio / gist:0e8be5f07b81dbdb49d6
Created December 22, 2014 23:01
GC crash in 1.4
$ go run bla.go
runtime: garbage collector found invalid heap pointer *(0x2081ce020+0x0)=0x1 s=nil
runtime: found *(0x2081b9ce0+0x28) = 0x2081ce020+0x0
fatal error: bad pointer
runtime stack:
runtime.throw(0x151ab9)
/usr/local/Cellar/go/1.4/libexec/src/runtime/panic.go:491 +0xad fp=0x7fff5fbff1a0 sp=0x7fff5fbff170
scanblock(0x2081b9ce0, 0x240, 0x1065e8)
/usr/local/Cellar/go/1.4/libexec/src/runtime/mgc0.c:412 +0x989 fp=0x7fff5fbff2e0 sp=0x7fff5fbff1a0
May - Cycling - Grizzly Peak Century https://www.grizz.org/century/
July - Running - SF Marathon http://www.thesfmarathon.com/
August - Cycling - Marin Century http://www.marincyclists.com/
September - Cycling - The Jensie GranFondo http://thejensiegranfondo.com/
October - Cycling - Levi's GranFondo https://www.levisgranfondo.com/
December - Running - Endurance Challenger https://www.thenorthface.com/get-outdoors/endurance-challenge/california.html