Copyright (c) 2011 Jed Schmidt
a small module for auto-importing modules in node.js.
require( "./autorequire" )
require.auto( <module-name> )
function(ks, vs, rr) { | |
// values are discarded by reduce | |
// todo: configurable key function, for complex queries | |
var fk, lk; | |
function uniqCount(keys) { | |
var count = 0, obj = {}; | |
for (var i=0; i < keys.length; i++) { | |
if (!obj[keys[i]]) { | |
count++; | |
obj[keys[i]] = true; |
require.registerExtension('.js', function(js){ | |
return js.replace(/^ *\/\/debug: */gm, ''); | |
}); |
// before | |
mainWindow.menu("File", function(err, file) { | |
if(err) throw err; | |
file.openMenu(function(err, menu) { | |
if(err) throw err; | |
menu.item("Open", function(err, item) { | |
if(err) throw err; | |
item.click(function(err) { | |
if(err) throw err; | |
mainWindow.getChild(type('Window'), function(err, dialog) { |
#!/usr/bin/python | |
import json, sys, re | |
filename = sys.argv[1] | |
f = open(filename, 'r') | |
contents = json.load(f) | |
contentIndex = {} | |
for content in contents['content']: |
emulate: | |
emulator -cpu-delay 0 -no-boot-anim -cache ./cache -avd default > /dev/null 2>&1 & # put the avd's chatty ass in the background | |
open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app | |
palm-emulator --start "SDK 1.4.5.465 (320x480)" |
var http = require("http"), | |
util = require("util") | |
http.createServer(function(req, rsp){ | |
var regex = /^\/(v1|v2)/g | |
var matches = req.url.match(regex) | |
if((matches && matches[0] === "/v1") || (req.headers["x-api-version"] === "v1")) | |
var port = 8001 |
python -m SimpleHTTPServer | |
By default, SimpleHTTPServer serves on port 8000. To specify a port, use (where 9090 is the port you want): | |
python -m SimpleHTTPServer 9090 | |
And to run it in the background, use: | |
python -m SimpleHTTPServer & |
<!DOCTYPE html> | |
<html> | |
<!-- | |
Copyright 2011 Google Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |