Skip to content

Instantly share code, notes, and snippets.

View ianbishop's full-sized avatar

Ian Bishop ianbishop

View GitHub Profile

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@ianbishop
ianbishop / ess.js
Created January 24, 2015 20:56
Elevator Saga Solution
{
init: function(elevators, floors) {
var floorsWithPassengersDown = [];
var floorsWithPassengersUp = [];
for (var e = 0; e < elevators.length; e++){
elevators[e].on("idle", function() {
var floorsWithPassengers = floorsWithPassengersDown.concat(floorsWithPassengersUp);
var currentFloor = this.currentFloor();
var floorNum = 0;
(defn search [queue matcher agent & params]
(->> queue
(filter #(apply m/matches matcher % agent params))
sorted-set))
@ianbishop
ianbishop / 0_reuse_code.js
Created June 3, 2014 23:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am ianbishop on github.
  • I am ianbishop (https://keybase.io/ianbishop) on keybase.
  • I have a public key whose fingerprint is D840 EE9A 7470 BEBB F133 6132 D2A3 AB2B 233A A7F7

To claim this, I am signing this object:

var counts = {};
var total = 0;
function freqIP(ip) {
var count = counts[ip];
if (count == undefined)
count = 1;
else
count++;
#!/usr/bin/env ruby
require 'rugged'
include Rugged
repo = Repository.new("/home/ian/open-source/stripe/level1/level1")
difficulty = "001"# `cat difficulty.txt`
index = repo.index
parallelSearch = (keywords, cb) ->
out = []
await
for k,i in keywords
search k, defer out[i]
cb out
serialSearch = (keywords, cb) ->
out = []
require 'faraday'
require 'faraday_middleware'
conn = Faraday.new(:url => 'your-url') do |faraday|
faraday.use FaradayMiddleware::EncodeJson
faraday.use Faraday::Response::RaiseError
faraday.use Faraday::Response::ParseJson
faraday.adapter Faraday.default_adapter
end
@ianbishop
ianbishop / gist:5654308
Created May 26, 2013 22:45
Updated weave's benchmarks to include fressian
Testing Deep Freeze
===================
- write mean: 312.07 µs
- read mean: 42.05 µs
Testing Carbonite
=================
- write mean: 177.35 µs
- read mean: 202.58 µs