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/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 |
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
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: |
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
<!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"> |
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
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 = {} |
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
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 = {} | |
models.Foobar = connection.model 'Foobar', schemas.Foobar |
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
net = require 'net' | |
assert = require 'assert' | |
settings = | |
# listen on this port | |
proxy_server: | |
host: 'localhost' | |
port: 4731 | |
# and proxy this guy |
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
domain = require 'domain' | |
bad = (msg, cb) -> | |
if (r = Math.random()) < 0.33 | |
cb null, msg | |
else if r < 0.66 | |
cb new Error('error via callback') | |
else | |
throw new Error('error via exception') |
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
CSVP <Buffer 61 2c 62 2c 63 2c 64 0a 31 2c 32 2c 33 2c 34 0a 35 2c 36 2c 37 2c 38 0a> | |
DUMP { a: '1', b: '2', c: '3', d: '4' } |
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
_ = require 'underscore' | |
stream = require 'stream' | |
fs = require 'fs' | |
csv = require 'csv' | |
# apply() for constructors | |
construct = (constructor, args) -> | |
F = -> constructor.apply this, args | |
F.prototype = constructor.prototype | |
new F |
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 util = require("util"); | |
var domain = require("domain"); | |
var express = require("express"); | |
var defaultErrHandler = express.errorHandler(); | |
module.exports = function totallyUseless(error, req, res, next) { | |
console.error("in error handler", error.stack) | |
if (domain.active) { | |
domain.active.emit("error", error); |
OlderNewer