Skip to content

Instantly share code, notes, and snippets.

View jt2190's full-sized avatar
🖥️
Thinkster.io

James Tikalsky jt2190

🖥️
Thinkster.io
View GitHub Profile
@jt2190
jt2190 / app.js
Last active December 20, 2015 15:39
An express.js application that uses async.js to initialize a MongoDB database connection pool before the application starts listening for HTTP requests. The database connection pool is shared using an application-wide variable named 'mongodb'.
var async = require('async'),
MongoClient = require('mongodb').MongoClient,
express = require('express');
var MONGODB_URL = 'mongodb://<username>:<password>@<host>:<port>/<database>',
PORT = -1;
async.waterfall([
function(cb) {
MongoClient.connect(MONGODB_URL, function(err, db) {
@jt2190
jt2190 / hubway.js
Created August 8, 2012 22:04
Example of EventEmitter
var http = require('http')
, util = require('util')
, url = "http://www.thehubway.com/data/stations/bikeStations.xml"
, events = require('events');
function handleError(e) {
console.error(e.message);
}
function ResponseDataListener(res) {
@jt2190
jt2190 / omniauth_fb_popup
Created December 26, 2011 15:55 — forked from anonymous/omniauth_fb_popup
Code for omniauth fb pop-up login
<html>
<head>
<title>Raoul Allwani's JavaScript problem</title>
</head>
<body>
<a class="login-popup">Login Popup Anchor</h1>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$('a.login-popup').click(function(e) {