Skip to content

Instantly share code, notes, and snippets.

@martinklepsch
martinklepsch / README.md
Last active May 31, 2020
`deps.lua` is an all-in-one script containing your declarative list of dependencies and installing any missing ones.
View README.md

deps.lua is an all-in-one script containing your declarative list of dependencies and installing any missing ones.

Kind of like Clojure's deps.edn except that the dependencies and code to download them are bundled in one package.

  • add link from file to gist so people can find back to here
  • add entries to .gitignore if available
  • ? if file ends in .fnl, download fennel.lua and compile to respective .lua file location

Usage in a fennel script

View rum-lifecycle-order-test.cljs
(defn log-lifecyle [component-name]
(into {}
(map (fn [lifecycle]
[lifecycle (fn [state] (js/console.log component-name lifecycle) state)]))
[:will-mount :will-unmount :did-mount :did-unmount]))
(rum/defc A < (log-lifecyle :A)
[]
[:span "A"])
View conjure-cheatsheet.md

Conjure Cheat Sheet

All prefixed by local leader, which is \ in my case.

:disconnect "cd"
:connect-port-file "cf"
:interrupt "ei"
:last-exception "ex"
:view-source "es"
@martinklepsch
martinklepsch / boot_sentry.clj
Created May 15, 2019
Boot tasks and helper functions to create Sentry releases and attach source maps to them
View boot_sentry.clj
(ns dev.boot-sentry
(:require [boot.util :as util]
[boot.core :as boot]
[clojure.data.json :as json]
[org.httpkit.client :as http]))
(def sentry-key "abc")
(def org "my-org")
(def project "frontend")
(def test-release "test-release-delete-me")
@martinklepsch
martinklepsch / README.md
Last active Nov 12, 2018
Notes about fixing https://cljdoc.org analysis issues with ClojureScript 1.10.439 https://github.com/cljdoc/cljdoc/issues/201
View README.md

How to analyze-file with foreign-lib dependencies?

  • I'm trying to figure out how to analyze a file that depends on react (via CLJSJS)
  • Previously cljdoc.org would analyze with *analyze-deps* set to false
  • With 1.10.439 this no longer works. (Dynamic vars can't be resolved, see old description below)
  • With *analyze-deps* set to true I need to properly supply the foreign lib information but I can't figure out how.

Solution

When calling cljs.analyzer.api/analyze-file with the state-as-first-arg arity it calls cljs.env/with-compiler-env which shadowed my own binding described in Current Approach section. I was unaware that analyzer.api/empty-state is actually just a compiler env as well so creating the right compiler env and passing it to analyze-file solved all issues:

View sqlite-index-not-used.md
SQLite version 3.24.0 2018-06-04 14:10:15
Enter ".help" for usage hints.
sqlite> .schema
CREATE TABLE stats (
  date        TEXT,
View pathom-cljdoc.clj
(ns cljdoc.pathom3
(:require [com.wsscode.pathom.core :as p]
[com.wsscode.pathom.connect :as pc]
[clojure.core.async :as async]
[clojure.set]
[cljdoc.util.repositories :as repos]
[cljdoc.util.pom :as pom]
[cljdoc.config :as config]
[cljdoc.storage.sqlite-impl :as cljdoc-sqlite]))
View pathom3.clj
(ns cljdoc.pathom3
(:require [com.wsscode.pathom.core :as p]
[com.wsscode.pathom.connect :as pc]
[clojure.core.async :as async]
[clojure.set]
[cljdoc.util.repositories :as repos]
[cljdoc.util.pom :as pom]
[cljdoc.config :as config]
[cljdoc.storage.sqlite-impl :as cljdoc-sqlite]))
@martinklepsch
martinklepsch / cljdoc-august.md
Last active Sep 6, 2018
My cljdoc August Update for ClojuristsTogether
View cljdoc-august.md

I switched the storage layer. SQLite is now used instead of lib-grimoire. More details in the respective architecture decision record: ADR-0013

This was a lot of work but it sets the project up for more interesting extensions besides API documentation and articles (think specs & examples).

Also I looked more into integrating specs but without changes to spec it is impossible to determine if a spec originates from the artefact that is being analysed or from one of it's dependencies. To fix this specs will need to support metadata (CLJ-2194) but the timeline for this is unclear.

In the light of this I'm considering focusing on examples first. More details to come.

Some more minor things that happened:

View cljdoc-updates.md

2018

August

2018-08-07 15:27,

  • Explored various metrics solutions to measure performance impact of new storage backend
You can’t perform that action at this time.