Skip to content

Instantly share code, notes, and snippets.

View isaksky's full-sized avatar

Isak Sky isaksky

View GitHub Profile
@isaksky
isaksky / re-frame-helper.cljs
Created January 9, 2018 03:51
reframe - Request Effect
(def req-counter (atom 0))
;; Not battle tested - adapted from an existing codebase
(rf/reg-fx
:request-giving-id
(fn [[request-id {:keys [on-complete resp-body-formatter request-args]
:or {on-complete identity
resp-body-formatter identity}
:as args}]]
@isaksky
isaksky / Output.txt
Created April 2, 2018 19:58
Gjallarhorn
Creating signal...
A dependency has changed. Called from thread ID 1
Setting m1...
Sleeping 200 ms
A dependency has changed. Called from thread ID 3
Signal value is now 4. thread ID: 3
Signal value is now 4. thread ID: 4
Thread awake again
Setting m2...
Finished
type Base() =
member x.Method() = "base method";
type Derived() =
inherit Base()
member x.Method() = "derived method"
type Base with
member x.Extension() = "base extension"
@isaksky
isaksky / Results.txt
Created April 25, 2018 23:24
Gjallarhorn read consistency
..................................X...X....X.X.X.X....XX.XXX...X.....XX....X..........XX.....X..X..XX..X.......X....X...XXX.X..X..XX....X.X..XX.X..X.X....X....X.X.XX.X..........XX..X....X.XX.X.XX..XXX.XXXXXX............X.....X..XX..XXX.....X.X.X.X....X..X.XX.XX.X..XX....X.......X..X.X...XX.XX..X..X..X..XX..X......X..XX.XX.XX..X.....X...XX..X.....XX......X.......X....X.................X.....................X...............X............X.X.......XX..XX......X.X.X...XXXX.X.XXXXXX.X.XX..X...X........X.....XX...X.XXXXXX.....XXXX.......X.X.X...XX..X.X....XXX...X....X..X.......X.X.........X.XX....X.........XX.XX.XX.X..X...X.X.X...XX....XX...........X........................X..X.X.X...XX....................X........XX.......X........X....X...............X............X..X.X.XXX...XXXX.....XX...X...X.....X......XX.X.X...X....X..X.X..X..X..XXX.X.XXXXX........XX....XX.X.XXXXX..X.X........X...........X..X.X.X...X......XX...X......X..X.X..X.X..X.....XX...X...X.....XX..X......X..X....X.XX.X..X.X.X.X.X.X..X....X.X....XX.X...
@isaksky
isaksky / codemirror.cljs
Created December 12, 2018 16:22
Reframe codemirror
(ns mything.components.codemirror
(:require [reagent.core :as reagent]
[re-frame.core :as rf]
[reagent.interop :refer [$]]
cljsjs.codemirror
cljsjs.codemirror.mode.clojure
cljsjs.codemirror.mode.sql))
(def codemirror-defaults {:lineNumbers true
:lineWrapping true
Initial Commit
@isaksky
isaksky / Foo.ex
Created May 23, 2019 15:00
Update URL via Liveview
# In somethingLive.ex:
def handle_event("some_event", _params, socket) do
assign(socket, :updated_url, Routes.project_path(MyApp.Endpoint, :index))
end
# In template: <%= js_url_update_script(assigns[:updated_url]) %>
# In form_helpers.ex, or similar:
@isaksky
isaksky / no-stutter.cljs
Last active September 17, 2019 23:32
Non stuttering text control in re-frame
(require '[reagent.ratom :as ra])
(require '[reagent.core :as reagent])
(require '[re-frame.core :as rf])
(defn non-stuttering-text-control [props]
(let [text-value-atom (atom "")
outside-change-counter (ra/atom 0)
to-dispose (atom [])]
(fn [props]
@isaksky
isaksky / gist:f693864aeedef8b54c1163342b36d788
Created October 8, 2019 16:10
Watch fancy CSS (less, scsss, etc) via shadow-cljs
(ns front.tasks.watch-css
(:require [clojure.java.io]
[clojure.java.shell :refer [sh]]
[juxt.dirwatch :refer [watch-dir]]
[clojure.core.async :as a]
[clojure.string :as str]
#_[shadow.cljs.devtools.api :refer [send-to-runtimes!]]))
(defn debounce-chan
"Taken from https://gist.github.com/xfsnowind/e15cc2e6da74df81f129"
@isaksky
isaksky / solution.sql
Last active November 4, 2019 16:33
Solution to Robot Journey in TSQL https://github.com/mikehadlow/Journeys
declare @input nvarchar(max) =
N'1 1 E
RFRFRFRF
1 1 E
3 2 N
FRRFLLFFRRFLL
3 3 N
0 3 W