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
| #!/usr/bin/env node | |
| var argv = require('optimist') | |
| .usage('Usage: --key=[consumer key] -secret=[consumer secret]') | |
| .demand(['key', 'secret']) | |
| .argv | |
| ; | |
| var OAuth = require('oauth').OAuth; | |
| var Step = require('step'); |
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
| YUI({ debug: DEBUG }).use('node', function(remotePage) { | |
| var url = 'http://example.com/foo.xml'; | |
| remotePage.fetch(url, function() { | |
| var userIdItems = remotePage.all('Users OnlineUsers OnlineUser UserID'); | |
| userIdItems.each(function(item) { | |
| console.log(item.get('innerHTML'); | |
| // Get an attr | |
| console.log(item.get('someattr'); |
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
| exports.render_to_response = function(responseInst, data, code, headers) { | |
| responseInst.send(data, headers, code); | |
| responseInst.end(); | |
| } |
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'); | |
| var fs = require('fs'); | |
| var url = require('url'); | |
| var word = process.argv[2]; | |
| var google = http.createClient(80, 'ajax.googleapis.com'); | |
| var request = google.request('GET', '/ajax/services/search/images?q=' + word + '&v=1.0&safe=off', {'host': 'ajax.googleapis.com'}); |
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
| /** | |
| * database.js | |
| * The core database setup file for the project | |
| */ | |
| /** | |
| * The couchdb module instance | |
| */ | |
| var cradle = require('cradle'); |
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 start = new Date().getTime(); | |
| var jsdom = require('jsdom').jsdom; | |
| var request = require('request'); | |
| var argv = require('optimist') | |
| .usage('numresults <word>') | |
| .check(function(argv) { if (argv._.length == 0) throw '' }) | |
| .argv; | |
| var url = 'http://www.google.com/search?hl=en&q=' + encodeURIComponent(argv._[0]); | |
| console.log(url); | |
| request({uri: url}, function(error, response, body) { |
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 frames = 0, last = 0; | |
| setInterval(function () { | |
| if (last) { | |
| var fps = frames / (Date.now() - last) * 1000; | |
| console.log('fps: ' + fps); | |
| } | |
| last = Date.now(); | |
| frames = 0; | |
| }, 1000); |
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 dependencies | |
| ### | |
| require.paths.unshift "#{__dirname}/lib/support/express-csrf/" | |
| require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/" | |
| express = require 'express' | |
| app = module.exports = express.createServer() | |
| RedisStore = require 'connect-redis' |
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
| require.paths.unshift('#{__dirname}') | |
| express = require 'express' | |
| app = express.createServer() | |
| app.configure( () -> | |
| app.set 'views', '#{__dirname}/views' | |
| app.use express.logger() | |
| app.use express.bodyDecoder() |
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 = (settings) -> | |
| cradle = require('cradle') | |
| return new(cradle.Connection)(settings.database.host, settings.database.port, settings.database.options) |
OlderNewer