Skip to content

Instantly share code, notes, and snippets.

View chrishowejones's full-sized avatar
🏠
Working from home

Chris Howe-Jones chrishowejones

🏠
Working from home
View GitHub Profile
@chrishowejones
chrishowejones / video_comment.clj
Created January 6, 2022 12:46
Recursive deletion experiment (as far as I got)
;; Functions added to clash.api.postgres/video-comment
(defn get-all-by-user
[postgres user-id]
(postgres/execute! postgres
{:select [:*]
:from :video-comments
:where [:and
[:= :deleted-at nil]
[:= :creator-id user-id]]}))
@chrishowejones
chrishowejones / gist:29f9a8306f0ce3c3aa4fb7a610d70195
Created July 21, 2019 11:46
Failed RVM Ubuntu package installation
$ sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.24.32.9).
0 to upgrade, 0 to newly install, 0 to remove and 65 not to upgrade.
sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done

Keybase proof

I hereby claim:

  • I am chrishowejones on github.
  • I am agile_geek (https://keybase.io/agile_geek) on keybase.
  • I have a public key ASCUGREwtGPjzrgbEptRRKZFvpmu7pbh8YGzCxJSF5Hj7Ao

To claim this, I am signing this object:

@chrishowejones
chrishowejones / FizzBuzzNoConditionals
Last active August 29, 2015 14:20
FizzBuzz without conditionals
;; Generates a range of numbers and returns "Fizz" if divisible only by 3, "Buzz"
;; if divisible only by 5 and "FizzBuzz" if divisible by 15 otherwise returns
;; the number as a string.
;; It does this by getting the modulus of 15 then using this as the index for a
;; map to look up the index of a second map where the index returned is the one
;; for "Fizz" for modulus result 3, 6 & 9 "Buzz" for 5 & 10 and "FizzBuzz" for
;; 0 (i.e. divisable by 15). Anything else will return nil from the first map
;; where nil is mapped to the value of the number in the second map.
;; Finally str is called to ensure that when the number is returned unchanged
;; it is transformed into a string to match "Fizz", "Buzz" & "FizzBuzz".
@chrishowejones
chrishowejones / Wrap-kerodon
Created January 21, 2015 14:33
How to close over Kerodon expressions so they can return truthy/falsey for use with lein-cucumber or deftest
(defmacro wrap-kerodon-test
[test_func]
"Wrap the kerodon test in a binding to that returns the test report counters that can be tested for :pass, :fail, etc."
`(binding [clojure.test/*report-counters* (ref clojure.test/*initial-report-counters*)]
~test_func
@*report-counters*))
(defmacro successful-kerodon-expr?
"Return true if the kerodon test function passed as arg runs without reporting a test failure."
[test_func]