Skip to content

Instantly share code, notes, and snippets.

Giles gilesbowkett

Block or report user

Report or block gilesbowkett

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View customer.rb
class Customer
attr_reader :name
def initialize(name)
@name = name
@rentals = []
end
def add_rental(arg)
@rentals << arg
@gilesbowkett
gilesbowkett / gist:10504817
Created Apr 11, 2014
Class/forName stack trace 2
View gist:10504817
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:10503896
Created Apr 11, 2014
Class/forName stacktrace (re Quil)
View gist:10503896
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)
View gist:daeefcb6e6bbae18bc5e
; 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 ])
View gist:8884428acf3f8aae4b84
# 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 Aug 29, 2015
waves example (in the waves repo, just pasted here for ease of embedding)
View gist:80efa7eeac291787a28b
# 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
View gist:b5726aa245197812e4c4
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
View gist:10f52c53505f9b418e8b
alias MacBook="sudo"
alias THELONIUS="sudo"
alias Air="sudo"
View gist:c71c416af8512dd69e99
# 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
}
You can’t perform that action at this time.