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 data | |
{:person/name "Bla" | |
:person/child {:child/something "other" | |
:child/bla {:subchild/entry "blabla"}}}) | |
(def MapWalker | |
(sp/recursive-path [] p | |
(sp/if-path map? | |
(sp/continue-then-stay sp/MAP-VALS p)))) |
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
(om/defui ^:once BasicChannelView | |
static om/IQuery | |
(query [_] [:channel/id {:channel/snippet [:channel/title]}])) | |
(om/defui ^:once ComplexChannelView | |
static om/IQuery | |
(query [_] [:channel/id | |
{:channel/snippet | |
[:channel/title | |
{:channel/thumbnails |
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
[org.clojure/clojure "1.9.0-alpha14"] | |
[org.clojure/clojurescript "1.9.494"] | |
[org.omcljs/om "1.0.0-alpha48"] | |
[clj-http "3.4.1"] | |
[cheshire "5.7.0"] | |
[camel-snake-kebab "0.4.0"] |
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
'{:dependencies [[org.clojure/core.async "0.2.395"]] | |
:node-dependencies [[request "2.81.0"]]} | |
(ns script.example | |
(:require [cljs.nodejs :as node])) | |
(def fs (node/require "fs")) | |
(def request (node/require "request")) |
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
[{[:video/by-id "XHGKIzCcVa0"] | |
[{:video/snippet | |
[:video/title | |
:video/description | |
:video/published-at | |
{:video/channel | |
[{:channel/snippet | |
[:channel/title | |
{:channel/thumbnails |
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 util.natural-sorting | |
(:refer-clojure :exclude [sort sort-by]) | |
(:require [clojure.string])) | |
(defn parse-int [s] | |
#?(:clj (Long/parseLong s) | |
:cljs (js/parseInt s))) | |
(defn vector-compare [[value1 & rest1] [value2 & rest2]] | |
(let [result (compare value1 value2)] |
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
(s/def ::reader-map (s/map-of keyword? ::reader)) | |
(s/def ::reader-seq (s/coll-of ::reader :kind vector?)) | |
(s/def ::reader-fn (s/fspec :args (s/cat :env map?) | |
:ret any?)) | |
(s/def ::reader | |
(s/or :fn ::reader-fn | |
:map ::reader-map | |
:list ::reader-seq)) |
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
;; this works under normal compilation | |
;; on advanced it fails with: https://www.dropbox.com/s/krf7c38bwykzldl/Screenshot%202016-07-10%2015.48.16.png?dl=0 | |
(defprotocol SampleProtocol | |
(some-method [this])) | |
(om/defui ^:once SampleClass | |
static om/IQuery | |
(query [_] [:query]) |
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 -u | |
# Created publish-local script that publish the repo to your ~/.m2/repository | |
# using your projects name and current version | |
# It assumes that you are: | |
# - in the same directory as the project.clj | |
# - the project name and version string are on the first line | |
project_name=$(head -n 1 project.clj | cut -d' ' -f2) |
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 debounce [in ms] | |
(let [out (chan)] | |
(go-loop [last-val nil] | |
(let [val (if (nil? last-val) (<! in) last-val) | |
timer (timeout ms) | |
[new-val ch] (alts! [in timer])] | |
(condp = ch | |
timer (do (>! out val) (recur nil)) | |
in (if new-val (recur new-val))))) | |
out)) |