技術ブログを書いていることをアフェリエイト目的とか、PV目的だとか言われた時に。
一見完璧に聞こえるけど、どう考えたって上手く回らない開発プロセスの説明を受けた時に。
ようやく理解できた時に。
(ns authexample.web | |
(:gen-class) | |
(:require [buddy.auth :refer [authenticated? throw-unauthorized]] | |
[buddy.auth.backends.session :refer [session-backend]] | |
[buddy.auth.middleware :refer [wrap-authentication wrap-authorization]] | |
[clojure.java.io :as io] | |
[compojure.response :refer [render]] | |
[reitit.ring :as ring] | |
[ring.adapter.jetty :as jetty] | |
[ring.middleware.params :refer [wrap-params]] |
Overview of recent projects and how they relate:
clj-kondo: Clojure linter, compiled with GraalVM for fast startup. While implementing clj-kondo I realized that analyzed code could not only be linted, but also interpreted. This gave rise to sci.
jet: converts between JSON, EDN and Transit. Supports minimal query language in the spirit of jq. While implementing the query language for jet, I realized that using normal Clojure instead of a DSL was better for most Clojure users. This gave rise to sci.
edamame: EDN parser with location metadata and configurable dispatch table. This way of parsing is inspired by rewrite-clj, but it skips the intermediate node representation. This parser was extracted from sci.
"Access-Control-Allow-Origin"ヘッダが返らないリソースへのアクセス結果が、ユーザースクリプトマネージャによって異なることを検証するためのユーザースクリプト。
テスト方法
ClojureScript master now has cljs.core/eval
. This delegates to cljs.core/*eval*
which, by default throws, but you can bind it to any implementation that can compile and evaluate ClojureScript forms.
If you require the cljs.js
namespace (which is the main support namespace for self-hosted ClojureScript), then cljs.core/*eval*
is set to an implementation that uses self-hosted ClojureScript for this capability. This means that all self-hosted ClojureScript environments will now have a first-class eval
implementation that just works. For example, Planck master:
$ planck -q
cljs.user=> (eval '(+ 2 3))
5
#!/bin/bash | |
############################################### | |
# To use: | |
# chmod +x install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
version=5.0.0 |
(defn classes-of | |
"Get the classes of an element as a Clojure keyword vector." | |
[e] | |
(let [words (-> e (.getAttribute "class") (string/split " "))] | |
(mapv keyword words))) | |
(defn classes->str | |
"Change a Clojure keyword seq into an HTML class string." | |
[classes] | |
(->> classes (mapv name) (string/join " "))) |
(ns cljsjs.jwt | |
(:require | |
[clojure.spec :as s] | |
[clojure.string :as str] | |
[goog.json :as json] | |
[goog.crypt.base64 :refer [encodeString decodeString]])) | |
;; https://github.com/Caligatio/jsSHA | |
;; goog.crypt.hmac produces different signature than nodejs version | |
(def jssha (js/require "jssha")) |
(ns foo | |
(:require [reagent.core :as r])) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;; global app-state | |
(defonce app-state (r/atom {})) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;; UI components |
This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.
The Atom documentation is excellent. It's highly worth reading the flight manual.