View core.clj
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
(transduce | |
(comp | |
(map-indexed (fn [idx item] [idx item])) | |
(map (fn [[idx item]] | |
(println "sending to space" idx) | |
[idx item]))) | |
(fn | |
;;completing arity | |
([accum] accum) | |
;;reduce arity |
View reanimated-v2-for-cljs.js
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
import React, {useImperativeHandle, useRef, forwardRef} from 'react'; | |
import Animated, { | |
useSharedValue, | |
useAnimatedStyle, | |
withTiming, | |
withSpring | |
} from 'react-native-reanimated'; | |
function Box(props, ref) { | |
const aRef = useRef(); |
View xf.clj
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 ss.experimental.comment-line-count | |
(:require [net.cgrand.xforms :as x])) | |
(defn count-comment-lines [] | |
(let [source (slurp "/Users/raspasov/cpp") | |
lines (line-seq | |
(java.io.BufferedReader. | |
(java.io.StringReader. source)))] | |
(transduce |
View CHEAT.md
Clojure(Script) Cheat Sheet
Start a ClojureScript Node REPL:
clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -M -m cljs.repl.node
Reload Clojure(Script) namespace from the REPL
View nested-data-structure-traversal.cljs
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
(def sections | |
;convert to Clojure data | |
(js->clj | |
#js [ | |
#js { | |
"title" "Getting started", | |
"reset_lesson_position" false, | |
"lessons" [ | |
{"name" "Welcome"}, | |
{"name" "Installation"} |
View xp.clj
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 scratch | |
(:require [clojure.core.async :as a] | |
[taoensso.timbre :as timbre])) | |
(def core-async-agent-state (atom 0)) | |
(def core-async-agent-ch (a/chan 1)) |
View core-async-101.cljs
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
(comment | |
;This takes at most ~2000 ms to execute | |
(let [process-seq-of-channels | |
(fn [chans] | |
(a/go | |
(loop [chans chans] | |
(if-not (empty? chans) | |
(let [ch (first chans) | |
resp (a/<! ch)] | |
(println resp) |
View gist:bc7e717adccee0ba5ad60cdea41d66d6
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
import React, {PropTypes, Component, useImperativeHandle, useRef, forwardRef} from 'react'; | |
import Animated, {useSharedValue, useAnimatedStyle, withTiming, withSpring} from 'react-native-reanimated'; | |
function Box(props, ref) { | |
const aRef = useRef(); | |
useImperativeHandle(ref, function () { | |
return { | |
moveBox: function (globalY) { |
View patch-metro-worker.cljs
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
;USAGE | |
;1. get https://github.com/planck-repl/planck | |
;2. run it from the project folder like this: | |
;plk patch-metro-worker.cljs | |
(require '[planck.core :refer [spit slurp]]) | |
;Works with ReactNative 0.62 | |
(def my-production-index-js-file-name "index.prod.js") |
NewerOlder