op | hash-map | sorted-map | hash-set | sorted-set | vector | queue | list | lazy seq |
---|---|---|---|---|---|---|---|---|
conj | log32n | log2n | log32n | log2n | 1 | 1 | 1 | 1 |
assoc | log32n | log2n | - | - | log32n | - | - | - |
dissoc | log32n | log2n | - | - | - | - | - | - |
disj | - | - | log32n | log2n | - | - | - | - |
nth | - | - | - | - | log32n | n | n | n |
get | log32n | log2n | log32 |
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
;; Solution based on https://stackoverflow.com/questions/50295703/create-custom-elements-v1-in-es5-not-es6 | |
(defn define-element! [name on-connect] | |
(let [my-el (fn [] (this-as this (.construct js/Reflect js/HTMLElement #js [] (.-constructor this)))) | |
_ (set! (.. my-el -prototype) (.create js/Object (.-prototype js/HTMLElement))) | |
_ (set! (.. my-el -prototype -constructor) my-el) | |
_ (.setPrototypeOf js/Object my-el js/HTMLElement) | |
_ (set! (.. my-el -prototype -connectedCallback) on-connect)] | |
(.define js/customElements name my-el))) | |
(define-element! :my-element #(.log js/console "hi!")) |
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
;; [cljsjs/react-virtualized "7.11.8-1" :exclusions [cljsjs/react]] | |
(ns react-virtualized.example | |
(:require [cljsjs.react-virtualized] | |
[clojure.string] | |
goog.date.DateTime | |
[reagent.core :as r])) | |
(defn fmt-value [v] | |
(cond |
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 demo.react-cljs-es6-classes | |
(:require [goog.object :as gobj])) | |
;; Demo of using bare React using ES6 classes (without createClass or reagent) | |
;; | |
;; Equivalent of Javascript/JSX: | |
;; | |
;; class MyComponent extends React.Component { | |
;; constructor(props) { | |
;; super(props); |
(defprofile lagénorhynque
Peter Naur, 1985
(copied from http://alistair.cockburn.us/ASD+book+extract%3A+%22Naur,+Ehn,+Musashi%22)
The present discussion is a contribution to the understanding of what programming is. It suggests that programming properly should be regarded as an activity by which the programmers form or achieve a certain kind of insight, a theory, of the matters at hand. This suggestion is in contrast to what appears to be a more common notion, that programming should be regarded as a production of a program and certain other texts.
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 app.mappy | |
#?(:cljs (:require-macros app.mappy)) | |
(:require #?(:clj [datascript.core :as d]) ; database on server | |
#?(:clj [clojure.data.csv :as csv]) | |
[hyperfiddle.electric :as e] | |
[hyperfiddle.electric-dom2 :as dom] | |
[hyperfiddle.electric-ui4 :as ui] | |
#?(:cljs ["@openlayers-elements/core/ol-map" :as ol-map]) | |
#?(:cljs ["@openlayers-elements/maps/ol-layer-openstreetmap" :as ol-layer-openstreetmap]) | |
#?(:cljs ["@openlayers-elements/core/ol-layer-vector" :as ol-layer-vector]) |
- 80 LOC: demo-reagent-interop.cljc (25 LOC for adapter)
20220729.photon.reagent.react.interop.mp4
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
# Replace REMOTE_NAME with your remote name (e.g. origin) | |
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done; |
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
Goal | CSS 3 | XPath | |
---|---|---|---|
All Elements | * | //* | |
All P Elements | p | //p | |
All Child Elements | p>* | //p/* | |
Element By ID | #foo | //*[@id=’foo’] | |
Element By Class | .foo | //*[contains(@class,’foo’)] | |
Element With Attribute | *[title] | //*[@title] | |
First Child of All P | p>*:first-child | //p/*[0] | |
All P with an A child | Not possible | //p[a] | |
Next Element | p + * | //p/following-sibling::*[0] |
OlderNewer