This file contains hidden or 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 example.portal | |
"Integration of Mount state management library & | |
Portal, the external browser-based state inspection tool. | |
see https://github.com/djblue/portal" | |
(:require [mount.core :refer [defstate]] | |
[portal.api :as p])) | |
(defn new-portal! [] (p/open)) | |
(defonce ^:dynamic *portal* nil) |
This file contains hidden or 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 io.github.humbleui.ui.wrap-label | |
(:require | |
[clojure.math :as math] | |
[clojure.string :as str] | |
[io.github.humbleui.core :as core] | |
[io.github.humbleui.protocols :as protocols] | |
[io.github.humbleui.ui.dynamic :as dynamic]) | |
(:import | |
[io.github.humbleui.skija Canvas Font FontMetrics Paint TextLine] | |
[io.github.humbleui.skija.shaper ShapingOptions])) |
This file contains hidden or 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
(defun clojure-only-sort-ns () | |
"Sorts the namespaces of a file on-save, but only for clj/cljs/cljc files" | |
(interactive) | |
(when (derived-mode-p 'clojure-mode 'clojurec-mode 'clojurescript-mode) | |
(clojure-sort-ns))) | |
(add-hook 'before-save-hook 'clojure-only-sort-ns) |
This file contains hidden or 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
;; Makes Emacs do Cursive's default behavior of inserting & evaling at REPL on C-x C-e | |
;; Tested on Feb 11 2021 with Emacs 27.2, CIDER 20220125.1326 | |
;; see discussion https://github.com/clojure-emacs/cider/issues/2617 | |
;; taken from WIP commit https://github.com/suvratapte/cider/commit/c177120ff243e032ee6e120e46ac4cccefc07991#diff-3f8317548fccd07e43ee8e69be1b3171 | |
(defun cider-insert-and-eval-last-sexp-in-repl (&rest args) | |
"Insert the expression preceding point in the REPL buffer and eval." | |
(interactive) | |
(cider-insert-last-sexp-in-repl t) | |
(cider-switch-to-last-clojure-buffer)) |
This file contains hidden or 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 app.nrepl | |
"Embedding an nREPL into a Clojure app that autopicks between CIDER & base handler based on JDK availability" | |
(:require | |
[mount.core :refer [defstate]] | |
[logger.core :as log] | |
[slingshot.slingshot :refer [try+ throw+]] | |
[cider.nrepl :as cider-nrepl] | |
[nrepl.server :as nrepl] | |
[clojure.reflect :refer [resolve-class]] | |
[clojure.set :as set] |
This file contains hidden or 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
;; MELPA (latest) | |
;; https://www.emacswiki.org/emacs/MELPA | |
(when (>= emacs-major-version 24) | |
(require 'package) | |
(add-to-list | |
'package-archives | |
'("melpa" . "http://melpa.org/packages/") | |
t) | |
(package-initialize)) |
This file contains hidden or 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 naming-strategy | |
(:require | |
[camel-snake-kebab.core :refer :all] | |
[clojure.reflect :refer :all])) | |
; Rough implementation of "naming strategy" feature in Clojure to guarantee consistent names on records | |
(defn is-camel-case? | |
[s] | |
(= s (->camelCase s))) |
This file contains hidden or 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 threading-comparison | |
(:require | |
[swiss.arrows :refer [-<> some-<>]])) | |
(defn schema-from-parameters | |
"Given a seq of YAML parameter maps (containing string keys 'in' and 'schema'), | |
returns a hash-map with keys (values of in) and values (values of schema). May return nil. | |
EX: ({in body schema {...}} | |
in header schema {...}}) | |
-> {:body {...JSON-SCHEMA...} |
This file contains hidden or 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 memory-storage | |
"Simple in-memory mocking of traditional RDBMS schema (tables/rows.)" | |
(:require [swiss.arrows :refer :all] | |
[com.concur.coreshell.util :as u])) | |
; Author: Quest Yarbrough | |
; URL: https://github.com/Quezion | |
; database is a hashmap with key table names, wrapped in an atom | |
; tables are a hashmap with key unique IDs | |
; rows are hashmaps with keys. they should not have IDs already assigned in them. |
This file contains hidden or 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 three.demo | |
(:require | |
[THREE])) | |
(defn get-camera [] | |
(let [camera (THREE.PerspectiveCamera. 75 (/ (.-innerWidth js/window) | |
(.-innerHeight js/window)) 1 10000)] | |
(set! (.-z (.-position camera)) 1000) | |
camera)) |