Skip to content

Instantly share code, notes, and snippets.

View BorisKourt's full-sized avatar

Boris Kourtoukov BorisKourt

View GitHub Profile
@akovantsev
akovantsev / cursive-shadow-cljs-repl-setup.md
Last active July 28, 2023 20:11
Setting up shadow-cljs cljs REPL in Cursive
@bhb
bhb / blockchain-w-spec.md
Last active July 1, 2022 11:24
Building a blockchain, assisted by Clojure spec

Building a blockchain, assisted by Clojure spec

In an effort to gain at least a superficial understanding of the technical implementation of cryptocurrencies, I recently worked my way through "Learn Blockchains by Building One" using Clojure.

This was a good chance to experiment with using spec in new ways. At work, we primarily use spec to validate our global re-frame state and to validate data at system boundaries. For this project, I experimented with using instrumentation much more pervasively than I had done elsewhere.

This is not a guide to spec (there are already many excellent resources for this). Rather, it's an experience report exploring what went well, what is still missing, and quite a few unanswered questions for future research. If you have solutions for any of the problems I've presented, please let me know!

You don't need to know or care about blockchains to understand the code be

@pjagielski
pjagielski / clojuredays_talk.clj
Last active August 24, 2022 02:37
My talk from Dutch Clojure Days 2017
(ns talk
(:require [overtone.core :refer :all]
[clojure.java.io :as io]))
;; Overtone by Sam Aaron & Jeff Rose
;; https://github.com/overtone/overtone
(definst da-funk [freq 440 dur 1.0 amp 1.0 cutoff 1700 boost 6 dist-level 0.015]
(let [env (env-gen (adsr 0.3 0.7 0.5 0.3) (line:kr 1.0 0.0 dur) :action FREE)
filter-env (+ (* freq 0.15)
@oliyh
oliyh / clj-sse.clj
Last active September 22, 2023 06:04
Clojure client for Server Sent Events (SSE)
(require '[clj-http.client :as http])
(require '[clojure.core.async :as a])
(require '[clojure.string :as string])
(require '[clojure.java.io :as io])
(import '[java.io InputStream])
(def event-mask (re-pattern (str "(?s).+?\r\n\r\n")))
(defn- parse-event [raw-event]
(->> (re-seq #"(.*): (.*)\n?" raw-event)
@baumandm
baumandm / GIF-Screencast-OSX.md
Last active November 3, 2023 07:18 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to Animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime and ffmpeg.

Forked from https://gist.github.com/dergachev/4627207. Updated to use a palette to improve quality and skip gifsicle.

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@mfikes
mfikes / comparison.md
Last active October 2, 2015 05:15
Compare embedded JavaScriptCore and Node.js (iojs)

Since an embedded JavaScriptCore can be made to launch quickly, I've been pondering whether it is justified in converting Planck to be a portable (OS X, Linux, Windows) C-based wrapper around JavaScriptCore (so that it is more broadly useful). Right now Planck is not portable owing to the use of Cocoa/Foundation and Objective-C.

I think this partially boils down to wether the launch latency is faster than an equivalent based on Node.js (which is already portable and has a much richer ecosystem). That latency has to be significantly different, and I also think you'd need to be convinced that it is going to remain that way (perhaps V8 will be further optimized, but perhaps the outright launch speed of Node.js isn't a priority).

@timsgardner
timsgardner / gist:968a260102cc0e747a7f
Created June 18, 2015 21:33
a fun-tastic game u kids
(ns wall-jiggle.wall-jiggle
(:use arcadia.core
arcadia.linear)
(:require [arcadia.updater :as updr])
(:import [UnityEngine Transform]))
(defscn wall
(let [top (GameObject. "wall")]
(dotimes [x 10]
(dotimes [y 10]
@mfikes
mfikes / ideas.md
Created June 6, 2015 16:35
Figwheel light ideas

It would be interesting if Figwheel could essentially decorate any implementation of IJavaScriptEnv, taking on the responsibility of watching the filesystem (perhaps even delegating that to ClojureScript :watch, and expanded :watch-fn, and perhaps minimally calling IJavaScriptEnv -load when Figwheel determines it is needed.

Then, for those REPLs that can participate, if IFigwheelSupport can be extended to them, they can do further cool stuff. (Perhaps IFigwheelSupport is actually necessary while IJavaScriptEnv as described in the previous paragraph is insufficient, and a more fancy impl of -load is needed?)

That way, things like the existing Node REPL could be minimally supported by Figwheel, as well as Ambly, the Browser REPL, etc.

What does IFigwheelSupport do?

Perhaps somewhere there is a HUD interface and Figwheel can ask a REPL to display things on its HUD? An iOS or Android-specific REPL could delegate to Objective-C or Java that implement a HUD using platform-specific UI widgets

@cemerick
cemerick / repl_interaction.txt
Created April 26, 2015 01:12
using cljs.jar + nREPL + piggieback
chas@t440p:~/Downloads$ java -cp cljs.jar:/home/chas/.m2/repository/org/clojure/tools.nrepl/0.2.10/tools.nrepl-0.2.10.jar:/home/chas/.m2/repository/com/cemerick/piggieback/0.2.1/piggieback-0.2.1.jar clojure.main nrepl_piggieback.clj &
nREPL server running on port 7888
# using Leiningen here _only_ to connect to the running nREPL server
# any nREPL client will do
chas@t440p:~/Downloads$ lein repl :connect 7888
Connecting to nREPL at 127.0.0.1:7888
REPL-y 0.3.5, nREPL 0.2.10
Clojure 1.7.0-beta1
@scttnlsn
scttnlsn / core.cljs
Last active July 2, 2016 07:36
Om/Secretary nested routing
(ns nested-routing.core
(:require-macros [om.core :as om]
[secretary.core :refer [defroute]])
(:require [om.dom :as dom]
[om.core :as om]
[secretary.core :as secretary]
[goog.events :as events]
[goog.history.EventType :as EventType])
(:import goog.History))