Skip to content

Instantly share code, notes, and snippets.

@rentalcustard
rentalcustard / repo.rb
Last active August 29, 2015 14:01 — forked from ernie/repo.rb
class PersonRepository < Norm::PostgreSQLRepository
def named(name)
select_records(select_statement.where(:name => name)
end
def named_ordered_by_created_at(name)
select_records(select_statement.
where(:name => name).
order(:created_at, :desc))
numberwang :: (Floating a) => a -> a -> String
numberwang x y
| x / y ^ 2 <= 18.5 = "a"
| x / y ^ 2 <= 25.0 = "b"
| x / y ^ 2 <= 30.0 = "c"
(defmacro new-if [pred then-clause else-clause]
`(cond ~pred ~then-clause
:else ~else-clause))
"This works, in that if I call it like so:
"
(new-if (= 2 3) (while true (print "hi")) :bye)
"I don't get an infinite loop, but I don't understand how. I've unquoted everything in the macro body, so shouldn't the normal evaluation order apply? Why doesn't it evaluate then-clause when I do it this way?
(defmacro new-if [pred then-clause else-clause]
`(cond ~pred ~then-clause
:else ~else-clause))
"This works, in that if I call it like so:
"
(new-if (= 2 3) (while true (print "hi")) :bye)
"I don't get an infinite loop, but I don't understand how. I've unquoted
scala> 'a' % 87.788
res0: Double = 9.212000000000003
scala> 'a' > 96
res1: Boolean = true
scala> 'a' - 97
res2: Int = 0
@rentalcustard
rentalcustard / gist:5a19949c08218b7a7557
Last active August 29, 2015 14:16
objective point of fuck you
A concern troll,
little boy on a derail-roll
last night's red wine
residue in a teacup, drying
I eat
hob nobs and spit you out
I read
your blog and shit while you pout
;original
(filter filter-fn some-collection)
;parallel filter
(map :val (filter (fn [m] (:allowed-by-filter m))
(pmap (fn [v] {:val s :allowed-by-filter (filter-fn v)}) some-collection)))
@rentalcustard
rentalcustard / MIRROREDALLWORDS.MARKDOWN
Last active September 9, 2015 13:17
BATTLES - MIRRORED - FULL LYRICS

Race : In

(whistling)

um-um-um-oh-towm-oh-hum-hum
oooh-oooh-oooh-oooh-oooh.
um-um-um-oh-towm-oh-hum-hum
oooh-oooh-oooh-oooh-oooh.
screen -t root 0 su -
screen -t shell 1 zsh
screen -t vim 2 vim
@rentalcustard
rentalcustard / gist:662328
Created November 4, 2010 10:54
Checkout state of code at last cap deploy to production.
#!/bin/bash
#Checkout source as at last prod deploy
tag=$(git tag | grep deploy-prod | tail -1)
git checkout $tag