Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View arichiardi's full-sized avatar

Andrea Richiardi arichiardi

View GitHub Profile
arichiardi / parallel.clj
Created March 31, 2022 15:46
Very simple parallel testing utility
(ns test.parallel
[clojure.core.async :as clj-async :refer [>! go]])
^{:dynamic true
arichiardi / app.clj
Created November 26, 2021 15:08
Integrant/Duct dev/prod app -main code
;; This setup solves the problem of prod and dev code path differing at startup.
;; The above issue leads to problems hard to catch, catch when deploying to prod.
;; in production main
(def duct-config-file-path (io/resource "/<project>/config.edn")
(defn prep-config
"Duct prep-config wrapper."
arichiardi / pom-deps-to-clj
Created June 3, 2019 19:17
Convert the output of mvn dependency:list to leiningen deps
#!/usr/bin/env bash
set -euo pipefail
# The following is the mvn dependency:list expected output
# [INFO] The following files have been resolved:
# [INFO] com.elasticpath.service.tenant:tenant-service-model:jar:1.0-SNAPSHOT:compile
# [INFO] com.elasticpath.service.tenant:tenant-service-dao:jar:1.0-SNAPSHOT:compile
arichiardi / shadow-build.clj
Created March 20, 2019 20:07
Shadow-cljs cljs deps.edn hook
(ns user.shadow-build
(:require [cheshire.core :as json]
[ :as io]))
(def ^:private package-json-path "package.json")
(def ^:private deps-edn-path "src/deps.cljs")
(defn deps-cljs
{:npm-deps (get package-json-edn "dependencies" {})})
arichiardi / package
Last active June 19, 2018 19:50
This is an example of how to bundle a ClojureScript artifact with webpack on node
do_usage() {
echo "Package the zip ready for lambda deployment."
echo " -s is the stage, will default to dev is absent."
echo " -p accepts an dir path where the package will be copied, it defaults
to \"./.serverless\"".
echo " -B option skips compilation, in case you already have compiled

lumo logo

Lumo Unbundled

This is a proposal for creating a new package along with lumo-cljs containing all the un-bundled JavaScript files needed for the current lumo to work, like:

  • target/bundle.min.js
  • target/main.js
  • target/
arichiardi /
Created March 5, 2018 21:12
Dump the Clojure :npm-deps index
clojure -e "(require '[cljs.closure :as cc] '[clojure.pprint :refer [pprint]]) (pprint (cc/index-node-modules-dir $(cat cljsc_opts.edn)))" > npm-deps.edn
arichiardi / build.clj
Last active November 11, 2017 15:12
Data oriented defedntask for boot-clj, sample (macro not included)
(def env-web-prod {:resource-paths #{"resources"}
:source-paths #{"src/web" "src/shared"}
:dependencies '[[org.clojure/clojure "1.9.0-alpha14"]
[adzerk/boot-cljs "2.0.0-SNAPSHOT" :scope "test"]
[org.clojure/clojurescript "1.9.456" :scope "test"]
[org.clojure/test.check "0.9.0"] ;; AR - at the moment we need it, see
[adzerk/env "0.4.0"]
[binaryage/oops "0.5.2"]
[cljsjs/d3 "4.3.0-3"]
[cljsjs/intersections "1.0.0-0"]
(require 'clojure.repl)
;; macros
(intern 'clojure.core (with-meta 'doc {:macro true}) @#'clojure.repl/doc)
(intern 'clojure.core (with-meta 'dir {:macro true}) @#'clojure.repl/dir)
(intern 'clojure.core (with-meta 'source {:macro true}) @#'clojure.repl/source)
;; fns
(intern 'clojure.core 'apropos @#'clojure.repl/apropos)
arichiardi / email.clj
Created July 15, 2016 18:28
Send an email with attachments using SES, postal and selmer
(:require [ :as log]
[clojure.string :as string]
[ :as io]
[schema.core :as s]
[camel-snake-kebab.core :as csk]
[camel-snake-kebab.extras :as cske]
[amazonica.core :as aws]
[ :as ses]
[selmer.parser :as selmer]