Skip to content

Instantly share code, notes, and snippets.

var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Global Crypto object
var Crypto = exports.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {
@lancecarlson
lancecarlson / cmd.sh
Created January 19, 2016 15:57
ZeroMQ HTTP example
clang -Wall http.c -o http -L/usr/local/Cellar/zeromq/4.0.5_2/lib/ -lzmq && ./http

Keybase proof

I hereby claim:

  • I am lancecarlson on github.
  • I am lancecarlson (https://keybase.io/lancecarlson) on keybase.
  • I have a public key ASDhreQapOJCcQEgLfxChM5hTfZP267zh8wXswQDLZPqzwo

To claim this, I am signing this object:

package mq
import (
"github.com/pebbe/zmq4"
"github.com/tylertreat/mq-benchmarking/benchmark"
)
func NewZeromqPipeline(numberOfMessages int, testLatency bool) *Zeromq {
ctx, _ := zmq4.NewContext()
function(doc, req) {
if (doc.type && doc.type == 'alert') {
return true;
}
return false;
}
@lancecarlson
lancecarlson / gist:5513834
Created May 3, 2013 20:33
example array of objects to JSON stream
var stream = JSONStream.stringifyObject()
stream.pipe(response)
_.pairs(myObject).map(function(current) { stream.write.apply(stream, current); })
stream.end()
<html>
<body>
<b>test</b>
</body>
</html>
class Shop
class Warehouse
def self.find(id)
Product.find_by_id(id)
end
end
class Customer
attr_reader :user
before :each do
@user = User.new(:email => 'riak@ripple.com')
@profile = Profile.new(:name => 'Ripple')
@billing = Address.new(:street => '123 Somewhere Dr', :kind => 'billing')
@shipping = Address.new(:street => '321 Anywhere Pl', :kind => 'shipping')
@friend1 = User.create(:email => "friend@ripple.com")
@friend2 = User.create(:email => "friend2@ripple.com")
end
it "should save a many linked association" do
var responseMap = {};
responseMap["/"] = function (req, res) {
// if (req.method === "GET")
sys.puts("getting");
var body = JSON.stringify({blah: "blah"});
sys.puts(sys.inspect(body));
res.writeHead(200, { "Content-Type": "text/json", "Content-Length:": body.length});
res.end(body);