Skip to content

Instantly share code, notes, and snippets.

View bonkydog's full-sized avatar

Brian Jenkins bonkydog

  • Nubank
  • SF Bay Area
View GitHub Profile
@bonkydog
bonkydog / gist:9379401
Created March 6, 2014 00:03
Gibbon barf
(@color -> case-eq-default 5 [ 'Green' : 10 ])
initial crumbs [["/"]]
locking /
-> <@color> = !12[@color]
-> <@color> = %a2
-> <@color -> case-eq-default 5 [ 'Green' : 10 ]> = %b3
-> <5> = %b3
-> <5> = (numeric)
-> <[ 'Green' : 10 ]> = (list (pair %a2 %b3))
-> <[ 'Green' : 10 ]> = (list %el4)
(ns datomizer.datoms
"Datom wrangling."
(:require [datomic.api :as d]
[datomizer.utility.debug :refer [dbg]]))
(ns datomizer.datomize.encode
"Encode entities by datomizing their data-structures."
(:require [datomic.api :as d :refer [q]]
[datomizer.datoms :refer :all]
[datomizer.utility.byte-array :refer [byte-array-class]]
[datomizer.utility.debug :refer :all]
[datomizer.utility.misc :refer [ref-type]]))
@bonkydog
bonkydog / gist:9980624
Created April 4, 2014 18:35
Clojure declare example.
(declare the-map)
(defn the-function
[whatever]
(whatever the-map))
(def the-map {:foo the-function})
@bonkydog
bonkydog / gist:c5d2a8bc598992577993
Created June 17, 2014 21:44
profile something with ruby_prof
require 'ruby-prof'
result = RubyProf.profile do
# do something
end
printer = RubyProf::MultiPrinter.new(result)
printer.print(path: ".", profile: "profile")
@bonkydog
bonkydog / ec2-ssh-tag.bash
Last active August 29, 2015 14:08
User data bash script to tag newly launched EC2 instance with its ssh host key fingerprint.
if curl -s http://169.254.169.254; then # looks like we're running on Amazon.
# Install Java
apt-get install -y openjdk-7-jre-headless
# Install EC2 command-line tools
wget https://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
unzip ec2-api-tools.zip -d /usr/local/ec2
# Set up EC2 environment variables
@bonkydog
bonkydog / user.clj
Last active August 29, 2015 14:14
Make stdout & stderr from all threads show up in cider repl
(alter-var-root #'*out* (constantly *out*))
(alter-var-root #'*err* (constantly *err*))
@bonkydog
bonkydog / delay_dock.bash
Created August 6, 2015 22:21
set OSX dock autohide / show delay
defaults write com.apple.Dock autohide-delay -float 10.0 && killall Dock
require "net/http"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
#
class ThingsController < ApplicationController
# GET /things
def index
@things = Thing.all
end
# GET /things/1
def show
@thing = Thing.find(params[:id])
end