View setup-neovim-ubuntu.txt
This file contains 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
# tested on ubuntu 20.04 | |
Install NeoVim | |
install a JDK (8/11 is fine) (I use azul) | |
install lein (a Clojure build tool) | |
sudo apt install nodejs git curl nvim python3-pip npm clang | |
sudo npm install -g neovim | |
pip3 install --upgrade pynvim jedi msgpack black | |
pip install --upgrade pynvim jedi msgpack | |
clone Clojure language server (clone https://github.com/snoe/clojure-lsp and run the install_clojure_lsp script. |
View records.clj
This file contains 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
(defprotocol Talker | |
(talk [this msg])) | |
(defrecord Hero | |
[name type position health objects] | |
Talker | |
(talk [this msg] | |
(println (:name this) ":" msg))) | |
(->Hero "Bad Guy" :warrior {:x 11 :y 344} 93 [:sword :dagger]) |
View clojure-map2.clj
This file contains 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
{:type :sword | |
:name "excalibur" | |
:strength 50 | |
:weight 40} |
View simple-map.clj
This file contains 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
{:type :warrior | |
:name "Bad guy" | |
:position {:x 11 :y 344} | |
:health 93 | |
:objects [:sword :dagger]} |
View mixed-data.clj
This file contains 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
[1 | |
"a string" | |
{"a-map-key" [42]} | |
['("this" "is" "a" "list" "of" "strings")] | |
#{\a \b} | |
] |
View data-flow1.clj
This file contains 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 foo [a b] | |
(let [x (+ a b)] | |
x)) | |
(def result (foo 3 4)) | |
result |
View match_example.clj
This file contains 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
(match/match [a b] | |
[_ true] :first | |
[true false] :second | |
[_ false] :third) | |
(try | |
(cond | |
(= b true) :first | |
(= b false) (try | |
(cond |
View DateTimeFormatter.java
This file contains 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
import java.time.LocalDateTime; | |
import java.time.ZonedDateTime; | |
import java.time.ZoneId; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.DateTimeFormatterBuilder; | |
import java.time.temporal.ChronoField; | |
public class Main { |
View core.clj
This file contains 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 toy-url-decoder.core | |
(:require [cemerick.url :as c-url] | |
[criterium.core :as crit]) | |
(:import [java.net URI URL] | |
[io.netty.handler.codec.http QueryStringDecoder] | |
[java.nio.charset Charset] | |
[org.apache.http.client.utils URLEncodedUtils] | |
[org.apache.http NameValuePair] | |
[java.util List Map Map$Entry])) |
View transcoder-get.clj
This file contains 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
user=> (aero/put c "index" "set-name" 42 1000) | |
<< … >> | |
user=> (defn inc-transcoder [rec] (when rec | |
#_=> (update rec :payload inc))) | |
#'user/inc-transcoder | |
user=> (d/chain (aero/get-single c "index" "set-name" {:transcoder inc-transcoder}) | |
#_=> :payload | |
#_=> println) | |
<< … >> | |
43 |
NewerOlder