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
(def x [["/foo" | |
["/bar" :bar] | |
["/baz" | |
["/quux" :quux]]] | |
["/yo" | |
[["/man" :man] | |
["/manman" :manman]]]]) | |
(require '[clojure.zip :as z] | |
'[clojure.string :as str]) |
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 skija.core | |
(:import [org.jetbrains.skija Canvas Surface Paint Color4f | |
EncodedImageFormat] | |
[java.nio.file Path Files OpenOption])) | |
(defn write-bytes [#^bytes b path] | |
(Files/write (Path/of "output.png" (make-array String 0)) b (make-array OpenOption 0))) | |
(defn show [] | |
(let [surface (Surface/makeRasterN32Premul 100 100) |
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 not-posh | |
(:require [clojure.string :as str] | |
[clojure.data :as data] | |
[datascript.core :as d] | |
[clojure.set :as set] | |
[seesaw.core :as ss])) | |
(defn- diff [a b] | |
;;TODO make diff ignore :swing/component key but include it in result | |
(let [[removed added] (data/diff a b) |
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
{:resources | |
[{:duna/type :provider/aws | |
:region "eu-west-1"} | |
{:duna/type :data/aws_ami | |
:duna/id :ubuntu | |
:most_recent true | |
:filter [{:name "name" | |
:values ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]} | |
{:name "virtualization-type" | |
:values ["hvm"]}] |
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
;; This will open a window with a single textfield where you can paste some HTML, | |
;; press <enter> and you should see a valid Clojure string get printed in your REPL, | |
;; without having to worry about escaping double quotes etc. | |
;; AND it fits a single tweet. :) | |
(import '[javax.swing JFrame JTextField] | |
'[java.awt.event ActionListener]) | |
(doto (JFrame.) | |
(.add (doto (JTextField.) |
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- add-path-prefix [[path & more] prefix] | |
(vec (concat [(str prefix path)] more))) ;;TODO handle stray slashes | |
(defn- prepend-interceptors [[path verb chain & more] interceptors] | |
(let [new-chain (if (vector? chain) | |
(vec (concat interceptors chain)) | |
(vec (concat interceptors [chain])))] | |
(vec (concat [path verb new-chain] more)))) |
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 sat.core | |
(:require [rolling-stones.core :as sat :refer [!]] | |
[clojure.string :as str])) | |
(def rows 9) | |
(def cols 9) | |
(def values 9) | |
(defn possible-square-values |
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 ensure-namespace-alias [ns alias-sym] | |
(when-not (find-ns ns) | |
(create-ns ns)) | |
(alias alias-sym ns)) | |
(ensure-namespace-alias 'this.is.a.long.namespace 'long) | |
::long/foo => :this.is.a.long.namespace/foo |
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
(require '[io.pedestal.log :as log] | |
'[clojure.data :as diff] | |
'[io.pedestal.interceptor.chain :as chain]) | |
(defn log-diffs [previous current] | |
(let [[deleted added] (diff/diff (dissoc previous ::chain/queue ::chain/stack ::previous-ctx) | |
(dissoc current ::chain/queue ::chain/stack ::previous-ctx))] | |
(when deleted (log/debug :deleted deleted)) | |
(when added (log/debug :added added)))) |
NewerOlder