Skip to content

Instantly share code, notes, and snippets.

If you want things, make them.

Rangel Spasov raspasov

If you want things, make them.
View GitHub Profile
raspasov / core.clj
Last active March 20, 2023 22:21
Transducers interrupt
View core.clj
(map-indexed (fn [idx item] [idx item]))
(map (fn [[idx item]]
(println "sending to space" idx)
[idx item])))
;;completing arity
([accum] accum)
;;reduce arity
raspasov / reanimated-v2-for-cljs.js
Created September 4, 2021 12:24
Reanimated v2 shim for CLJS
View reanimated-v2-for-cljs.js
import React, {useImperativeHandle, useRef, forwardRef} from 'react';
import Animated, {
} from 'react-native-reanimated';
function Box(props, ref) {
const aRef = useRef();
raspasov / xf.clj
Created May 6, 2021 09:49
Count comment lines
View xf.clj
(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
( source)))]
raspasov /
Last active April 19, 2021 14:44
Clojure(Script) Cheat Sheet

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

raspasov / nested-data-structure-traversal.cljs
Last active April 12, 2021 10:55
A solution to a poorly defined "problem" :)
View nested-data-structure-traversal.cljs
(def sections
;convert to Clojure data
#js [
#js {
"title" "Getting started",
"reset_lesson_position" false,
"lessons" [
{"name" "Welcome"},
{"name" "Installation"}
raspasov / xp.clj
Last active January 7, 2021 09:50
core.async agents experiment
View xp.clj
(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))
raspasov / core-async-101.cljs
Created January 5, 2021 07:22
core.async 101
View core-async-101.cljs
;This takes at most ~2000 ms to execute
(let [process-seq-of-channels
(fn [chans]
(loop [chans chans]
(if-not (empty? chans)
(let [ch (first chans)
resp (a/<! ch)]
(println resp)
View gist:bc7e717adccee0ba5ad60cdea41d66d6
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) {
raspasov / patch-metro-worker.cljs
Last active April 28, 2020 22:34
Patches metro's worker.js for :advanced compilation to work with React Native
View patch-metro-worker.cljs
;1. get
;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 "")