Skip to content

Instantly share code, notes, and snippets.

class Customer
attr_reader :name
def initialize(name)
@name = name
@rentals = []
end
def add_rental(arg)
@rentals << arg
@gilesbowkett
gilesbowkett / gist:10503896
Created April 11, 2014 21:41
Class/forName stacktrace (re Quil)
Exception in thread "main" java.lang.RuntimeException: EOF while reading string, compiling:(circles/core.clj:146:1)
at clojure.lang.Compiler.load(Compiler.java:7137)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
@gilesbowkett
gilesbowkett / gist:10504817
Created April 11, 2014 21:56
Class/forName stack trace 2
Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: .getDeclaredMethod for class java.lang.Class, compiling:(circles/core.clj:130:19)
at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
@gilesbowkett
gilesbowkett / gist:daeefcb6e6bbae18bc5e
Created May 7, 2014 20:00
clojure problem halp pls
; given this vector
(def probabilities [ 1 0 0 0.5
0 0 1 0 ])
; I want to run (< (rand) probability) against each element
; and ultimately get back either
(def result [ 0 0.75 1.5 ])
# bash script
# accomplishes https://twitter.com/raganwald/status/501535500365086720
function MacBook() {
if [ $1 == "THELONIUS" ]
then
if [ $2 == "Air" ]
then
@gilesbowkett
gilesbowkett / gist:80efa7eeac291787a28b
Last active August 29, 2015 14:05
waves example (in the waves repo, just pasted here for ease of embedding)
# sinatra
get "/show" do
# render a template here
# maybe sneak in ActiveRecord or something
end
# waves equivalent, isolated for simplicity
on :get, :show => [ 'entry', :name ] do
model.foobar = model.foo_or_bar? # business logic
response.content = model.to_json # serialization
response.headers += "Content-type: foo/bar" # protocol details
response.send # ok go
alias MacBook="sudo"
alias THELONIUS="sudo"
alias Air="sudo"
# only open After Effects if cache hard drive is plugged in
function fx() {
if [ -d /Volumes/Vanniman\ Time\ Machine/ ]
then
open -a Adobe\ After\ Effects\ CC
fi
}