Skip to content

Instantly share code, notes, and snippets.

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:

@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
package mq
import (
"github.com/pebbe/zmq4"
"github.com/tylertreat/mq-benchmarking/benchmark"
)
func NewZeromqPipeline(numberOfMessages int, testLatency bool) *Zeromq {
ctx, _ := zmq4.NewContext()
@lancecarlson
lancecarlson / gist:1c32c598a961f5d0b132
Last active August 29, 2015 14:03
jquery dependencies
$ git grep '$\.'
README.md:Card renders with default values for card `name`, `number`, `expiry`, and `cvc`. To override these values, you can either pass in a `values` object or set `$.card.values` before initializing `card`. Do
README.md:// setting $.card.values is one way to override
README.md:$.card.values = {
README.md:To render the card with the strings in a different language, you can either pass in a `messages` object or set `$.card.messages` before initializing `card`. Do one or the other, not both.
README.md:// setting $.card.messages is one way to override
README.md:$.card.messages = {
lib/js/card.js: $.payment = {};
lib/js/card.js: $.payment.fn = {};
lib/js/card.js: $.fn.payment = function() {
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Global Crypto object
var Crypto = exports.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {
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 => '[email protected]')
@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 => "[email protected]")
@friend2 = User.create(:email => "[email protected]")
end
it "should save a many linked association" do