Skip to content

Instantly share code, notes, and snippets.

TJ Holowaychuk tj

Block or report user

Report or block tj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md

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.

View gist:2892258
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);
});
View gist:2504880
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 Nov 15, 2011 — forked from Fuitad/gist:1368444
Jade debugging
View foo.js
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) {
View tj
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.");
View foo.js
// Expose modules in ./support for demo purposes
require.paths.unshift(__dirname + '/../../support');
/**
* Module dependencies.
*/
var express = require('../../lib/express')
, form = require('connect-form');
View request headers for failing get request in connect
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
View html5boilerplate.jade
!!! 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]
View out.css
header nav {
-webkit-box-shadow: 1px 1px 3px #555;
-moz-box-shadow: 1px 1px 3px #555;
box-shadow: 1px 1px 3px #555;
}
View debugging_opowerjobs.com.js
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'),
You can’t perform that action at this time.