Skip to content

Instantly share code, notes, and snippets.

@tj
tj / README.md
Created March 30, 2014 05:07 — forked from mbostock/.block

A test for the new topojson.merge functionality that will be available in the next release of TopoJSON, 1.6. The state boundaries are computed by merging the county boundaries!

The merge algorithm appears to have some issues with Virginia’s small counties; I am currently investigating this problem.

var express = require("express");
var app = express.createServer();
app.configure(function(){
app.use(express.bodyParser());
app.use(express.methodOverride()); // this uses req.body from bodyParser() so it should be below
app.use(express.static(__dirname + '/public'));
app.use(app.router);
});
function tagsMiddleware(req, res, next) {
res.local('tags', {});
if (req.session.logged_in) {
User.findOne({ _id: req.session.user_id }, function (err, docs) {
if (!err) {
res.local('tags', {
ignored: docs.ignored_tags,
favorite: docs.favorite_tags
});
}
@tj
tj / foo.js
Created November 15, 2011 21:42 — forked from Fuitad/gist:1368444
Jade debugging
debug> run
debugger listening on port 5858connecting... ok
breakpoint #1 in #<Object>.[anonymous](exports=#<Object>, require=function require(path) {
return Module._load(path, self);
}, module=#<Module>, __filename=/Volumes/Fuitad/Documents/www/app.js, __dirname=/Volumes/Fuitad/Documents/www), /Volumes/Fuitad/Documents/www/app.js:1
(function (exports, require, module, __filename, __dirname) { var conf = require('./conf'),
^
debug> continue
debug> Express server listening on port 3000 in development mode
break in [anonymous](req=#<IncomingMessage>, res=#<ServerResponse>, function callbacks(err) {
@tj
tj / tj
Created July 22, 2011 20:32 — forked from randallb/gist:1100361
exports.register = function(req, res, next) {
var client;
client = this.client;
return exports.validate(req, res, function() {
return client.hmset("person:" + req.body.wid, req.body, function(err, response) {
if (err != null) {
return next(err);
} else {
req.newUser = req.body;
console.log("success. Saved record.");
// Expose modules in ./support for demo purposes
require.paths.unshift(__dirname + '/../../support');
/**
* Module dependencies.
*/
var express = require('../../lib/express')
, form = require('connect-form');
Accept:application/json, text/javascript, */*; q=0.01
Cache-Control:max-age=0
Content-Type:application/json
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.04 Chromium/11.0.696.68 Chrome/11.0.696.68 Safari/534.24
X-Requested-With:XMLHttpRequest
!!! 5
/if lt IE 7
<html class="no-js ie6" lang="en">
/if IE 7
<html class="no-js ie7" lang="en">
/if IE 8
<html class="no-js ie8" lang="en">
//[if (gte IE 9)|!(IE)]><!
html(class="no-js", lang="en")
//<![endif]
@tj
tj / out.css
Created February 25, 2011 06:16 — forked from visnup/shadow.sass
header nav {
-webkit-box-shadow: 1px 1px 3px #555;
-moz-box-shadow: 1px 1px 3px #555;
box-shadow: 1px 1px 3px #555;
}
require.paths.unshift('./support');
require.paths.unshift('./support/connect/lib');
require('proto');
var log = require('./lib/util/log').from(__filename),
Connect = require('connect'),
Express = require('express'),
Assets = require('./lib/assets'),