Skip to content

Instantly share code, notes, and snippets.

@jimmyjacobson
jimmyjacobson / server.js
Created July 21, 2011 06:09 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@jimmyjacobson
jimmyjacobson / gist:1175944
Created August 27, 2011 22:26
Redirecting using javascript
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/ strict.dtd">
2
3 <html lang="en"> <head> <meta charset=utf-8>
4 <script src="/javascripts/jquery-1.6.2.min.js"></script>
6 <script lang="text/javascript">
7 $(document).ready(function() {
8 window.location = "/path/to/content?ts={{version number}}";
9 });
10 </script>
var params = {
login: this.login,
apiKey: this.apiKey,
longUrl: encodeURIComponent(longUrl)
};
var qs = [];
for(var key in params) {
qs.push(key + '=' + params[key]);
}
qs = qs.join('&');
@jimmyjacobson
jimmyjacobson / gist:1224117
Created September 17, 2011 16:45
Aggregating Users and Topics in Klout
<?php
$user = $_GET["user"];
$key= YOUR_KLOUT_KEY;
$response = array('user' => $user);
$topicUrl = "http://api.klout.com/1/users/topics.json?users=$user&key=$key";
$json = file_get_contents($topicUrl,0,null,null);
$topics = json_decode($json);
@jimmyjacobson
jimmyjacobson / gist:1631704
Created January 18, 2012 07:10
Redis Queries
=== database object file
var errors = require('./errors');
var db;
exports.setDatabase = function(database) {
db = database;
}
@jimmyjacobson
jimmyjacobson / gist:1651125
Created January 21, 2012 03:33
Doing weird stuff with Redis
Let's start with some people
vegastech:people:person:raycmorgan {
name: Ray Morgan
}
vegastech:people:person:jimmyjacobson {
name: Jimmy
}
@jimmyjacobson
jimmyjacobson / gist:1681767
Created January 26, 2012 08:33
Error on Event Creation
curl -d "startDate=1234" "http://localhost:3000/event"
{
"type": "ValidationError",
"msg": "Event creation failed",
"errors": [
{
"msg": "missing parameter",
"parameter": "endDate"
},
var http = require('http');
var redis = require("redis")
, db = redis.createClient();
function main(callback) {
var options = {
host: "search.twitter.com",
port: 80,
path: "/search.json?q=momolv"
//Prefix
var prefix = exports.prefix = 'cinchtool';
//link Keys
exports.link = 'link';
exports.links = 'links';
exports.linksId = prefix + ':ids:link';
exports.linkKey = function(id) {
return prefix + ':link:' + id;
}
@jimmyjacobson
jimmyjacobson / gist:1922339
Created February 27, 2012 07:52
Sampel Code
if (false); {
console.log('WHY AM I SEEING THIS!?!?!?!');
}