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
from math import pi,sqrt,sin,cos,asin,atan2 | |
from simplegeo import Client | |
import json | |
def get_nearby_zips(address, radius, client): | |
''' | |
Given an address and radius (and the SimpleGeo client), returns | |
a comma-separated list of zip codes within that radius. | |
''' | |
context = client.context.get_context_by_address(address) |
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
function isEmail(email) { | |
var regex = /^([a-zA-Z0-9_\.\-\+])+\@@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; | |
return regex.test(email); | |
} | |
$("#validate-form").submit(function (event, dontCheck) { | |
$email = $('#email'); | |
$form = $('#validate-form'); | |
var email = $email.val(); |
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
$(document).ready(function() { | |
simplegeo_key = 'TOKEN'; | |
var places_client = new simplegeo.Places12Client(simplegeo_key); | |
var context_client = new simplegeo.ContextClient(simplegeo_key); | |
var zips = { | |
zips: '' | |
}; |
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 EventEmitter = require('events').EventEmitter; | |
var util = require('util'); | |
// Here is the Ticker constructor | |
var Ticker = function() { // This is a pseudo-class } | |
util.inherits(Ticker, EventEmitter); | |
// Emit tick on the tick event | |
Ticker.prototype.tick = function() { |
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
/** | |
* Facebook Client for Node.js | |
* @author Josh Smith | |
*/ | |
var qs = require('querystring'), | |
request = require('request'), | |
conf = require('../config/conf'); | |
var Facebook = exports.Facebook = function(userId, accessToken) { |
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
everyauth.facebook | |
.entryPath('/auth/facebook') | |
.scope('email, user_likes, user_location, offline_access, publish_stream, publish_checkins, publish_actions') | |
.appId(app.settings.fbAppId) | |
.appSecret(app.settings.fbAppSecret) | |
.findOrCreateUser(function(session, accessToken, accessTokExtra, fbUserMetadata) { | |
User.findOne().where('facebook.id', fbUserMetadata.id).run(function(err, user) { | |
console.log(user); | |
if(user) { | |
// Update |
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
data: 2011-12-02T00:15:12.772Z: throw e; // process.nextTick error, or 'error' event on first tick | |
data: 2011-12-02T00:15:12.772Z: ^ | |
data: 2011-12-02T00:15:12.772Z: Error: ECONNREFUSED, Connection refused | |
data: 2011-12-02T00:15:12.772Z: at Socket._onConnect (net.js:601:18) | |
data: 2011-12-02T00:15:12.772Z: at IOWatcher.onWritable [as callback] (net.js:186:12) | |
data: 2011-12-02T00:15:12.765Z: Warning: connection.session() MemoryStore is not | |
data: 2011-12-02T00:15:12.765Z: designed for a production environment, as it will leak | |
data: 2011-12-02T00:15:12.765Z: memory, and obviously only work within a single process. | |
data: 2011-12-02T00:15:12.392Z: carapace has wrapped: /usr/local/src/joshsmith/wadsup/wadsup/app.js |
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
data: 2011-12-02T02:09:16.333Z: events.js:47 | |
data: 2011-12-02T02:09:16.333Z: throw new Error("Uncaught, unspecified 'error' event."); | |
data: 2011-12-02T02:09:16.333Z: ^ | |
data: 2011-12-02T02:09:16.333Z: Error: Uncaught, unspecified 'error' event. | |
data: 2011-12-02T02:09:16.333Z: at [object Object].emit (events.js:47:15) | |
data: 2011-12-02T02:09:16.333Z: at [object Object].<anonymous> (/usr/local/src/joshsmith/wadsup/wadsup/node_modules/pg/lib/client.js:10... | |
data: 2011-12-02T02:09:16.333Z: at [object Object].emit (events.js:64:17) | |
data: 2011-12-02T02:09:16.333Z: at Socket.<anonymous> (/usr/local/src/joshsmith/wadsup/wadsup/node_modules/pg/lib/connection.js:47:12) | |
data: 2011-12-02T02:09:16.333Z: at Socket.emit (events.js:64:17) | |
data: 2011-12-02T02:09:16.333Z: at Socket._onReadable (net.js:678:14) |
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express'); | |
// Create the server | |
app = express.createServer(); |
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 pg = require('pg'); | |
client = new pg.Client(app.settings.db); | |
client.on('error', function(error) { | |
console.log(error); | |
}); |