Convert Cojure code from this article "Creating a TODO cli with Clojure" to use with Babashka: https://dev.to/prasannagnanaraj/i-just-created-a-todo-cli-with-clojure-1133
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 fun.clojure.paillier | |
(:import [java.math BigInteger] | |
[java.security SecureRandom] | |
[java.nio.charset StandardCharsets])) | |
(defn- random-number! [end] | |
(let [start (BigInteger/valueOf 2) | |
interval (.subtract end start) | |
i (BigInteger. (.bitCount interval) (SecureRandom.))] | |
(.add start i))) |
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
#!/usr/bin/env bb | |
(ns script | |
"Make a 'Code Quality' report from clj-kondo for use in GitLab CI. | |
JSON issue format: | |
https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool | |
Usage: | |
Add the following job in .gitlab-ci.yml: |
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
<html> | |
<head> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism-tomorrow.min.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"></script> | |
<pre> | |
<code class="language-clojure"> | |
(defn 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 '[clojure.string :as s]) | |
;; Maze GENERATION | |
(defn north-of [[row col]] [(dec row) col]) | |
(defn south-of [[row col]] [(inc row) col]) | |
(defn west-of [[row col]] [row (dec col)]) | |
(defn east-of [[row col]] [row (inc col)]) | |
(defn neighbours [rows cols cell] |
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
; The Expression Problem and my sources: | |
; http://stackoverflow.com/questions/3596366/what-is-the-expression-problem | |
; http://blog.ontoillogical.com/blog/2014/10/18/solving-the-expression-problem-in-clojure/ | |
; http://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/ | |
; http://www.ibm.com/developerworks/library/j-clojure-protocols/ | |
; To begin demonstrating the problem, we first need some | |
; "legacy code" with datastructures and functionality: |