Skip to content

Instantly share code, notes, and snippets.

View joshrotenberg's full-sized avatar
💀

josh rotenberg joshrotenberg

💀
View GitHub Profile
var sys = require('sys'),
times = 500000
function bm(label, fn) {
var start = +new Date
fn()
sys.puts(' ' + label + ' : ' + (+new Date - start) + ' ms')
};
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <time.h>
#include <stdbool.h>
#include <ev.h>
#include <evcom.h>
@joshrotenberg
joshrotenberg / nest-nav.html
Created October 12, 2011 22:21
trying to get a nested slideshow with cycle to allow navigation of the subslides within the sub slides themselves.
<!DOCTYPE html>
<html>
<head>
<title>JQuery Cycle Plugin - Nested Slideshows</title>
<style>
body { margin: 40px }
#controls { width: 200px; height: 55px }
#slideshow,#controls { margin: auto; overflow: hidden; }
#inner { overflow: hidden; }
#prev, #prev-inner { float: left; }

NOTE: This documentation has been put here because I couldn't find it anywhere else. I am not associated with Crunchbase in any way. I cannot help you with your Crunchbase API problems. If you need help try here: https://groups.google.com/forum/#!forum/crunchbase-api

CrunchBase API v1 Documentation

Overview

The CrunchBase API provides JSON representations of the data found on CrunchBase. The API currently supports three actions: "show", "search", and "list", which are each described below.

(ns ufold.core)
(use 'lamina.core 'aleph.tcp 'gloss.core)
(require 'gloss.io)
(use 'protobuf)
(defprotobuf Msg Ufold$Msg)
(defn dump-bytes [bytes]
(prn (seq bytes)))
@joshrotenberg
joshrotenberg / gist:1499232
Created December 19, 2011 22:36
style of client/worker request
;; i have this working on the client/send side using a multimethod
;; currently, sending looks like this
(let [reply (mdc/send! reverse-client "reverse3" "bleh")]
;; or like this
(let [reply (mdc/send! reverse-client "reverse3" '("bleh" "foo" "bar"))]
;; or
(let [reply (mdc/send! reverse-client "reverse3" ["bleh" "foo" "bar"])]
@joshrotenberg
joshrotenberg / gist:1541682
Created December 30, 2011 22:00
clojure ascii printable character stuff
(defn printable-char?
[c]
(if (and (> (int c) 32)
(< (int c) 127))
(char c)))
(def request (ordered-map
:req (string :utf-8 :length 4)
:type request-type
:size data-size
:data (string :utf-8)))
@joshrotenberg
joshrotenberg / cassandra-node-token.clj
Created January 27, 2012 19:57
clojure function to generate cassandra node tokens for a cluster
(use 'clojure.contrib.math)
(defn cassandra-token [number-nodes]
(dotimes [n number-nodes]
(println (format "token: %d %d" n (* n (quot (expt 2 127) number-nodes))))))
@joshrotenberg
joshrotenberg / fizzbuzz.erl
Created April 6, 2012 19:12
playing around with fizzbuzz in erlang
-module(fizzbuzz).
-export([start/0, start2/0]).
start() ->
fizzbuzz(1).
start2() ->
fizzbuzz2(1).