Skip to content

Instantly share code, notes, and snippets.

View rgarcia's full-sized avatar

Rafael rgarcia

View GitHub Profile
@rgarcia
rgarcia / test.coffee
Created April 30, 2012 21:33
weird mongoose behavior
step = require 'step'
mongoose = require 'mongoose'
Schema = mongoose.Schema
schemas = {}
schemas.Foobar = new Schema
name : { type: String, trim: true, required: true, unique: true }
connection = mongoose.createConnection 'mongodb://127.0.0.1:27017/sandbox'
models = {}
@rgarcia
rgarcia / index.html
Created February 18, 2012 05:05
backbone + d3
<!DOCTYPE html>
<html>
<body>
<svg width="100%" height="100%"viewBox="0 0 50 50"></svg>
</body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/backbone/backbone.js"></script>
<script type="text/javascript">
def factorial_sumofdigits(n):
val = 1
for i in xrange(1,n+1):
val *= i
return sum([int(c) for c in str(val)])
for i in xrange(1,10000):
f = factorial_sumofdigits(i)
print i, f
if f == 8001:
@rgarcia
rgarcia / lolla.py
Last active September 25, 2015 09:47
script to tell us when the lollapalooza front page changes, so that we can get in on ticket deals quickly
#!/usr/bin/python
# script to tell us when the lollapalooza front page has changed, presumably to get ticket deals
import urllib2
import time
import md5
import smtplib
import random
from email.mime.text import MIMEText