This file contains hidden or 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
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
This file contains hidden or 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 sys = require("sys"), | |
http = require("http"), | |
ws = require('./deps/node-websocket-server/lib/ws'), | |
fs = require("fs"); | |
var iostat = require("child_process").spawn("iostat",["-w 1"]); | |
var httpServer = http.createServer(); | |
var server = ws.createServer({debug:true},httpServer); | |
// Format iostat date |
This file contains hidden or 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
diff --git a/lib/connect/middleware/session.js b/lib/connect/middleware/session.js | |
index a83cb16..7d1c17c 100644 | |
--- a/lib/connect/middleware/session.js | |
+++ b/lib/connect/middleware/session.js | |
@@ -32,7 +32,7 @@ exports = module.exports = function sessionSetup(options){ | |
var key = options.key || 'connect.sid'; | |
// Default memory store | |
- var store = options.store || new (require('./session/memory')); | |
+ var store = exports.store = options.store || new (require('./session/memory')); |
This file contains hidden or 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 http = require('http'), | |
sys = require('sys'), | |
URL = require('url'), | |
querystring = require('querystring'), | |
OAuth = require('oauth').OAuth; | |
var oa = new OAuth('https://api.twitter.com/oauth/request_token', | |
'https://api.twitter.com/oauth/access_token', | |
'YOUR APP CONSUMER KEY HERE', | |
'YOUR APP CONSUMER SECRET HERE', |
This file contains hidden or 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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
This file contains hidden or 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 doHash(str, seed) { | |
var m = 0x5bd1e995; | |
var r = 24; | |
var h = seed ^ str.length; | |
var length = str.length; | |
var currentIndex = 0; | |
while (length >= 4) { | |
var k = UInt32(str, currentIndex); | |
This file contains hidden or 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
package preloadagent; | |
/** | |
Copyright 2010 Sam Pullara | |
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 |
This file contains hidden or 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 InstantiateFunction(data, name) { | |
// We need a reference to kApiFunctionCache in the stack frame | |
// if we need to bail out from a stack overflow. | |
var cache = kApiFunctionCache; | |
var serialNumber = %GetTemplateField(data, kApiSerialNumberOffset); | |
var isFunctionCached = | |
(serialNumber in cache) && (cache[serialNumber] != kUninitialized); | |
if (!isFunctionCached) { | |
try { | |
cache[serialNumber] = null; |
This file contains hidden or 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
// Declare an object literal as a namespace | |
var Utils = {}; | |
// Define an sort of ES5 forEach (this is demo only, so it's fast and loose) | |
Utils.forEach = function(arr, callback) { | |
var iter = 0, | |
len = arr.length; |
This file contains hidden or 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.exports = function(app){ | |
app.set('view engine', 'jade'); | |
// etc | |
} |