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
client.on('moreLoad', function(obj) { | |
Posts.find({_id: { $lt: obj.data.postId } }).sort('createdDate', 1).limit(perPage).execFind(function(err, res) { | |
console.log(err); | |
console.log(res); | |
if (res != null) { | |
client.emit('loadPosts', {data: res}); | |
} | |
}); | |
}); |
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
// SETUP | |
// Get the required modules | |
var express = require("express"), | |
mustachio = require("mustachio"), | |
sys = require("sys"), | |
app = express.createServer(); | |
// Configure the app | |
app.configure(function() { |
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
var mongoose = require('mongoose'), | |
db = mongoose.connect('mongodb://localhost/blog'), | |
Schema = mongoose.Schema, | |
fields = ['createdDate', 'canComment', 'story', 'title', 'user']; | |
var commentsSchema = new Schema({ | |
user : { type: String }, | |
comment : { type: String }, | |
createdDate : { type: Date, default: Date.now } | |
}); |
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
<?php | |
$queue = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REQ, "MySock1"); | |
$queue->connect("tcp://127.0.0.1:5555"); | |
$res = $queue->send("test")->recv(); | |
echo "got ".$res; | |
?> |
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
<?php | |
/* | |
* Multithreaded Hello World server. Uses proceses due | |
* to PHP's lack of threads! | |
* @author Ian Barber <ian(dot)barber(at)gmail(dot)com> | |
*/ | |
function worker_routine() { | |
$context = new ZMQContext(); | |
// Socket to talk to dispatcher |
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
<?php | |
class liveNode { | |
private $host = '127.0.0.1'; | |
private $port = '5566'; | |
static private $queue; | |
private $timeout = 5000; // milliseconds | |
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
fizbo:go-twitter phillyqueso$ gomake | |
6g -o _go_.6 api.go status.go user.go search.go util.go rate_limit.go http_auth.go | |
api.go:68: undefined: error | |
api.go:69: undefined: error | |
api.go:95: undefined: error | |
api.go:528: undefined: error | |
util.go:27: undefined: error | |
http_auth.go:50: undefined: error | |
http_auth.go:90: undefined: error | |
http_auth.go:109: undefined: error |
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
<?php | |
$reduce = <<<EOD | |
function(key, values) { | |
var resKeys = ['firstName', 'lastName', 'email', 'status', 'percentComplete', 'completionDate', 'orgs']; | |
var results = {firstName: null, lastName: null, email: null, status: null, percentComplete: null, completionDate: null, orgs: null}; | |
values.forEach(function(value) { | |
resKeys.forEach(function(k) { | |
switch(k) { | |
case 'orgs': |
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
<?php | |
require_once '../etl/etl_boot.php'; | |
$reduce = <<<EOD | |
function(key, values) { | |
var resKeys = ['firstName', 'lastName', 'email', 'status', 'percentComplete', 'completionDate', 'orgs']; | |
var results = {firstName: null, lastName: null, email: null, status: null, percentComplete: null, completionDate: null, orgs: null}; | |
values.forEach(function(value) { |
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
Meteor.methods({ | |
chargeDoc: (key, stripeToken) -> | |
if Meteor.user()?.profile | |
curUser = Meteor.user().profile | |
doc = Documents.findOne({key: key}) | |
if !doc.price | |
return "can't buy something without a price" | |
else | |
fut = new Future() | |
Stripe.charges.create |
OlderNewer