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 redis = require('redis'); | |
var pubcli = redis.createClient(6380, '127.0.0.1'); | |
var subcli = redis.createClient(6380, '127.0.0.1'); | |
var datacli = redis.createClient(6380, '127.0.0.1', {return_buffers:true}); | |
var have = 0; | |
datacli.lrange('data.theresource', 0, -1, function(err,chunks) { | |
console.log("initial data!",chunks); |
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 jsdom = require('jsdom'); | |
jsdom.env({ | |
html: "<html><body></body></html>", | |
scripts: [ | |
'http://code.jquery.com/jquery-1.6.2.min.js', | |
'http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js' | |
] | |
}, function (err, window) { | |
var $ = window.jQuery; |
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
/** | |
* Showing with the Express framwork http://expressjs.com/ | |
* Express must be installed for this sample to work | |
*/ | |
var tropoapi = require('tropo-webapi'); | |
var express = require('express'); | |
var app = express.createServer(); | |
var sys = require('sys'); |
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
// Scraping Made Easy with jQuery and SelectorGadget | |
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga) | |
// by David Trejo | |
// | |
// Install node.js and npm: | |
// http://joyeur.com/2010/12/10/installing-node-and-npm/ | |
// Then run | |
// npm install jsdom jquery http-agent | |
// node numresults.js | |
// |
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
http = require 'http' | |
url = require 'url' | |
fs = require 'fs' | |
path = require 'path' | |
server = http.createServer (req, resp) -> | |
uri = url.parse req.url, yes | |
query = uri.queryString | |
filepath = path.normalize uri.pathname |
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
// Two ways to serve transparent GIF | |
var buf = new Buffer([ | |
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, | |
0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, | |
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, | |
0x02, 0x44, 0x01, 0x00, 0x3b]); | |
res.send(buf, { 'Content-Type': 'image/gif' }, 200); |
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. | |
*/ | |
var express = require('express') | |
, io = require('socket.io'); | |
var app = module.exports = express.createServer(); | |
// Configuration |
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"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
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 Request = require("request"); | |
// USER: API 用戶名稱 | |
// PWD: API 密碼 | |
// SIGNATURE: 簽名 | |
/* METHOD: SetExpressCheckout | |
RETURNURL:當於PayPal 網站完成明細確認後,瀏覽器將帶顧客返回至此網址。 | |
CANCELURL:當顧客選擇終止付款時,瀏覽器將帶顧客返回至此網址。 |
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
# Create the app on the Cedar stack: | |
heroku create --stack cedar | |
# Creating sharp-rain-871... done, stack is cedar | |
# http://sharp-rain-871.herokuapp.com/ | [email protected]:sharp-rain-871.git | |
# Git remote heroku added | |
# Rename the application. | |
heroku rename newname | |
git push heroku master |