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
[ | |
{ | |
"uri": "/mydb/mycollection/", | |
"method": "POST", | |
"headers": { | |
"Content-Type": "application/x-www-form-urlencoded", | |
"Content-Length": "123" | |
}, | |
"body": "v=SOME JSON ENCODED STRING WITH VALUE _id = 1" | |
}, |
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
{ | |
"accounts": [ | |
"123456@facebook", | |
"654321@twitter" | |
], | |
"123456@facebook": { | |
"sessionid": "12334fddt3t3t" | |
}, | |
"654321@twitter": { | |
"oauthkey": "2433gfwg325t", |
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
/* | |
* BEGIN Custom patches | |
*/ | |
// This is the content type I will return on most of my requests, | |
// so I'm adding it as the default. I can overwrite the headers | |
// to change it if necessary on the individual handlers. | |
http.ServerResponse.prototype.headers = ["Content-Type: text/html"]; | |
http.ServerResponse.prototype.writeHeadArray = function(statusCode){ |
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
/* | |
* mongodb based sessions with rotating tokens | |
*/ | |
require("./Math.uuid"); | |
var sys = require("sys"); | |
var cookies = require("./cookies"); | |
var mongo = require('./mongodb'); | |
Session = function(req, res, callback){ |
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
/* | |
* mongodb based sessions with rotating tokens | |
*/ | |
require("./Math.uuid"); | |
var sys = require("sys"); | |
var cookies = require("./cookies"); | |
var mongo = require('./mongodb'); | |
Session = function(req, res, callback){ |
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
<script type="text/javascript"> | |
YUI().use('anim', 'node', function(Y){ | |
Y.one("#footer-newsticker").removeClass("hidden"); | |
var tickernode = Y.one('#footer-newsticker') | |
/* This gets the max value of scrollLeft quickly, making for smooth | |
* animation with no delay before the fade and rest. | |
*/ | |
tickernode.set('opacity', 0); | |
tickernode.set('scrollLeft', tickernode.get('offsetWidth')); | |
var maxScroll = tickernode.get('scrollLeft'); |
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
class MongoCache(object): | |
def __init__(self, db, collection="cache", size=100000): | |
self.db = db | |
self.collection = collection | |
collections = self.db.collection_names() | |
if not self.collection in collections: | |
self.db.create_collection(self.collection, capped=True, size=size) | |
def set(self, k, v, ttl): |
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
YUI().use('cookie', 'io-base','json-parse', 'event-custom', function(Y) { | |
var cookieDate = new Date(); | |
cookieDate.setMinutes(cookieDate.getMinutes() + 30); | |
function locationComplete(id, o) { | |
var data = Y.JSON.parse(o.responseText); | |
if (data.error == 0) { | |
Y.Cookie.set("fwixid", data.result.id, { expires: cookieDate }); | |
Y.Cookie.set("fwixpretty", data.result.pretty, { expires: cookieDate }); | |
} else { |
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
--- local.search results | |
<?xml version="1.0" encoding="UTF-8"?> | |
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" | |
yahoo:count="0" yahoo:created="2010-12-13T20:02:06Z" yahoo:lang="en-US"> | |
<diagnostics> | |
<publiclyCallable>true</publiclyCallable> | |
<url execution-time="40" http-status-code="503" http-status-message="Service Unavailable"><![CDATA[http://local.yahooapis.com/LocalSearchService/V3/localSearch?zip=94085&query=pizza&start=1&results=10]]></url> | |
<user-time>62</user-time> | |
<service-time>40</service-time> |
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
<input type="text" name="q" id="q" /> | |
<script type="text/javascript"> | |
YUI().use("autocomplete", "autocomplete-highlighters", "datasource-get", function (Y) { | |
var acDS = new Y.DataSource.Get({ | |
source: "http://sugg.search.yahoo.com/gossip-us-fp/?nresults=10&queryfirst=2&output=json&version=&command=", | |
}); | |
Y.one('#q').plug(Y.Plugin.AutoComplete, { | |
maxResults: 10, | |
resultHighlighter: 'phraseMatch', |
OlderNewer