This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; REPL session to play around with clojure.spec | |
;; ------------- START INITIAL SETUP ------------- | |
;; assume these dependencies are specified in the repl environment: | |
;; [org.clojure/clojure "1.9.0-alpha15"] | |
;; [org.clojure/test.check "0.9.0"] | |
;; My leiningen setup: | |
;; cat ~/.lein/profiles.clj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boot repl | |
(set-env! :dependencies '[[clojure.java-time "0.2.2"]]) | |
(require '[java-time :as t]) | |
(t/time-between (t/local-date 2014 9 27) (t/local-date 2017 2 18) :weeks) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env boot | |
(set-env! :dependencies '[[clj-http "2.3.0"] [cheshire "5.7.0"]]) | |
(require '[clj-http.client :as client]) | |
(require '[clojure.pprint :as pp]) | |
;; Fifa country codes - https://en.wikipedia.org/wiki/List_of_FIFA_country_codes | |
(def countries [ | |
{:id 426 :key :ENG :description "England"} | |
{:id 436 :key :ESP :description "Spain"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Running this script in bash: | |
curl -s http://api.football-data.org/v1/competitions/436/leagueTable | jq '.' | tr -d , | grep teamName | awk -F":" 'BEGIN {print "{\n"} {print NR, $2} END {print "\n}"}' | |
;; Results in a clojure map: | |
{ | |
1 "Real Madrid CF" | |
2 "FC Barcelona" | |
3 "Sevilla FC" |
NewerOlder