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
(defn show-routes | |
"Prints the application's route table" | |
[] | |
(print-routes routes)) | |
(defn named-route | |
"Finds a route by name" | |
[route-name] | |
(->> routes | |
(filter #(= route-name (:route-name %))) |
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
#!/bin/bash | |
set -e | |
CHECKOUT=/tmp/clojurescript.git | |
rm -rf $CHECKOUT | |
git clone --bare [email protected]:clojure/clojurescript.git $CHECKOUT >/dev/null 2>&1 | |
pushd $(pwd) > /dev/null | |
cd $CHECKOUT | |
VERSION=$(git describe --abbrev=0 --tags | sed "s/^r//") |
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
(ns datascript-to-datomic-util | |
(:require [datascript :as d])) | |
;;;; a utility to help with a datomic-datascript roundtrip process involving: | |
;;; 1. export some data from a datomic database and transact into a datascript instance. | |
;;; 2. perform one or more transactions against datascript. | |
;;; 3. transact the sum of all changes made against datascript back into datomic in a single tx | |
;;; this namespace contains two public functions: | |
;;; listen-for-changes: listen to datascript transactions and build up a record of changes |
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
(def path-element (s/or :key keyword? :index integer?)) | |
(s/def :column/title string?) | |
(s/def :column/spec (s/or :path (s/+ path-element) | |
:path+keys (s/cat :path (s/* path-element) | |
:keys (s/coll-of keyword? [])) | |
:path+fn (s/cat :path (s/* path-element) | |
:fn fn?) | |
:fn fn?)) | |
(s/def ::column (s/keys :req [:column/title :column/spec])) | |
(s/def :grid/title string?) |
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
{:product/type :product.type/ebp | |
:product/name "Teen Intervene" | |
:product/surveys | |
[{:survey/type :survey.type/pre | |
:survey/title "Pre-Test" | |
:survey/version 3 | |
:survey/questions | |
[{:question/id 2030 | |
:question/text "Do you smoke?" | |
:question/type :question.type/single-option |
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
// implementing map in terms of reduce | |
function count(coll) { | |
return (typeof coll === "undefined") ? 0 : coll.length; | |
} | |
function isEmpty(coll) { | |
return (0 === count(coll)); | |
} |
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
(def github-repositories-url "https://api.github.com/search/repositories") | |
(defn repositories-req [language] | |
(go (let [response (<! (http/get github-repositories-url | |
{:with-credentials? false | |
:query-params {"q" (str "language:" language) | |
"sort" "stars" | |
"order" "desc"}}))] | |
;; just *use* the value inside this block... | |
(println (get-in response [:body :items])))) |
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
# (c) 2016 Mario Cruz | |
# please credit me if you modify and/or use this code | |
# not for commercial use | |
# lots of help from Giles Booth @blogmywiki | |
# and Christian Romney Twitter: @christianromney | |
import os | |
import glob | |
import json | |
import random |
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
# (c) 2016 Mario Cruz | |
# please credit me if you modify and/or use this code | |
# not for commercial use | |
# lots of help from Giles Booth @blogmywiki | |
# and Christian Romney Twitter: @christianromney | |
import os | |
import glob | |
import json | |
import random |
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
{"title": "Fire and Ice", | |
"author": "Robert Frost", | |
"text": ["Some say the world will end in fire,", | |
"Some say in ice.", | |
"From what I've tasted of desire,", | |
"I hold with those who favor fire.", | |
"But if I had to perish twice,", | |
"I think I know enough of hate", | |
"To say that for destruction ice", | |
"Is also great", |