Skip to content

Instantly share code, notes, and snippets.

View isaksky's full-sized avatar

Isak Sky isaksky

View GitHub Profile
isaksky / keybindings.json
Created June 1, 2023 20:26
Calva Keybindings, WASD movement
// Disable crazy VSCode default bindings
"key": "ctrl+shift+w",
"command": "-workbench.action.closeWindow"
"key": "ctrl+w",
"command": "-workbench.action.closeActiveEditor"
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 [$]]
(def codemirror-defaults {:lineNumbers true
:lineWrapping true
isaksky / step.cljc
Last active August 3, 2021 22:30
tbd.step macro
(ns tbd.step
[clojure.spec.alpha :as s]))
(s/def ::binding-kvp (s/cat :lhs symbol? :rhs any?))
(s/def ::bindings
(s/conformer vec vec)
isaksky / TransactSqlWrapping.fs
Last active July 24, 2021 14:07
F# Generated wrapper for Microsoft.SqlServer.TransactSql
module Foo
open System
open Microsoft.SqlServer.TransactSql
type [<RequireQualifiedAccess>] TSqlFragment =
| AdHocDataSource of InitString:StringLiteral option * ProviderName:StringLiteral option
| AddFileSpec of File:ScalarExpression option * FileName:Literal option
| AlterAvailabilityGroupAction of AlterAvailabilityGroupAction
| AlterAvailabilityGroupFailoverOption of OptionKind:ScriptDom.FailoverActionOptionKind * Value:Literal option
| AlterDatabaseTermination of ImmediateRollback:bool * NoWait:bool * RollbackAfter:Literal option
isaksky /
Last active June 25, 2021 19:21
Working with SQL syntax trees in F#

Working with SQL syntax trees in F#

Update 12/15/2016 - Added Sql generation

Welcome to my blog post for #FsAdvent 2016.

If you're using a relational database, as your application grows in size, at some point you may find yourself looking for an SQL parser. This can give you lots of leverage, for example allowing you to:

  • Do permission checks on queries before executing them
  • Rewrite incorrect or inefficient queries
isaksky / i18n-impl.cljs
Created November 5, 2019 05:05
Handling translations in ClojureScript
(ns front.utilities.i18n-impl
(:require [front.i18n]))
(defn build-domain-index [text-vec]
(let [by-msgid (atom (transient {}))
by-msg (atom (transient {}))]
(doseq [{:keys [s_message s_message_id] :as text} text-vec]
(when-not (clojure.string/blank? s_message_id)
(swap! by-msgid assoc! s_message_id text))
(when-not (clojure.string/blank? s_message)
isaksky / reframe-helper.cljs
Last active September 15, 2020 14:56
Register delayed subscription
(ns foo
(:require [re-frame.core :as rf]
[reagent.ratom :as ra :refer [reaction]])
(:import goog.async.Debouncer))
(defn reg-sub-delayed
"Similar to reg-sub, except the computation is debounced.
It can be called like this:
isaksky / solution.sql
Last active November 4, 2019 16:33
Solution to Robot Journey in TSQL
declare @input nvarchar(max) =
N'1 1 E
1 1 E
3 2 N
3 3 N
0 3 W
isaksky / gist:f693864aeedef8b54c1163342b36d788
Created October 8, 2019 16:10
Watch fancy CSS (less, scsss, etc) via shadow-cljs
(:require []
[ :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"
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]