Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Making it easy to use Clojure(Script) at home and work

Jon B. Seltzer seltzer1717

💭
Making it easy to use Clojure(Script) at home and work
View GitHub Profile
View replace-digits.clj
(defn shift
"Takes digit char, returns int offset from zero."
[nbr]
(- (int nbr) (int \0)))
(defn next-pair
"Reducing fn, takes acc, the destructured pair [chr nbr]
and returns next acc."
[acc [chr nbr]]
(conj acc chr (if nbr (char (+ (int chr) (shift nbr))))))
View apartment-test.clj
(ns cloud.seltzer1717.s3.apartment-test
(:require [clojure.test :as test]
[cloud.seltzer1717.s3.apartment :as apt]))
(test/with-test
(def sample-blocks
[{:gym false :school true :store false}
{:gym true :school false :store false}
{:gym true :school true :store false}
View island.clj
(ns cloud.seltzer1717.island)
(defn border-fn
[sample]
(let [rows (count sample)
cols (count (first sample))]
(fn [[row col]]
(or (= 0 row)
(= 0 col)
(= (dec rows) row)
View core.clj
;; Directions:
;;
;; mvn clean install
;; ...
;; run javap
;; rem All classes created with compile call
;; rem cloud.seltzer1717.core
;; rem cloud.seltzer1717.core__init
;; rem cloud.seltzer1717.core$_main
;; rem cloud.seltzer1717.core$fn__158
@seltzer1717
seltzer1717 / parsehtml.clj
Last active Oct 31, 2017
Converts Bootstrap HTML to ClojureScript Om Code
View parsehtml.clj
(ns com.seltzer1717.term.server.parsehtml
(:import
(java.io FileReader FileWriter BufferedReader BufferedWriter)
(javax.swing.text.html HTMLEditorKit HTMLEditorKit$ParserCallback HTML$Tag HTML$UnknownTag HTML$Attribute)
(javax.swing.text.html.parser ParserDelegator)))
(def new-elements
#{"section" "article" "main" "aside" "header" "footer" "nav" "figure"
"figcaption" "template" "video" "audio " "track" "source" "embed"
"mark" "progress" "meter" "time" "ruby" "rt" "rp" "bdi" "wbr" "canvas"
@seltzer1717
seltzer1717 / calculator.clj
Last active Feb 24, 2020
Web Services with Clojure
View calculator.clj
;; Example use of Java annotations in Clojure.
;;
;; The example uses javax.jws package to build a simle web service.
;;
;; Make sure you have Clojure and Java.
;; This example uses Clojure 1.8.0 and JDK8.
;;
;; Create the following folder structure:
;;
;; | webCalculator
@seltzer1717
seltzer1717 / fxml.clj
Last active Aug 5, 2016
Programming JavaFX in Clojure.
View fxml.clj
;;; Namespace for gui detail.
(ns clojure.fxml
(:import
(java.io StringWriter)
(javax.xml.stream XMLOutputFactory)
(javafx.scene.layout AnchorPane GridPane ColumnConstraints Priority)
(javafx.scene.control TitledPane)
(javafx.geometry HPos VPos)))
(def fxdoc