Skip to content

Instantly share code, notes, and snippets.

View shanewilson's full-sized avatar

Shane Wilson shanewilson

View GitHub Profile
@realgenekim
realgenekim / example.clj
Created November 6, 2023 21:07
Simple example of using wkok/openai-clojure library in streaming mode
(ns openai.a01-async-openai
(:require
[com.fulcrologic.guardrails.core :refer [>defn >defn- >def | ? =>]]
[wkok.openai-clojure.api :as api]
[openai.companies :as companies]
[diehard.core :as dh]
[clojure.data.json :as json]
[clojure.edn :as edn]
[clojure.spec.alpha :as s]
[clojure.core.async :as a :refer [<!! >!! <! >!]]
@pesterhazy
pesterhazy / building-sync-systems.md
Last active May 1, 2026 20:42
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

(defn iteration-op-map
"Iterates an op-map based step. Useful in aws-api and gcp-api. Returns a list
of results from each page after applying :itemsf. If an anomaly is returned
from invoke-fn, it will be included in the list."
[invoke-fn op-map {:keys [request-key response-key itemsf]}]
(iteration
(fn [next-token]
(invoke-fn
(cond-> op-map
next-token (assoc-in [:request request-key] next-token))))
@didibus
didibus / clojure-right-tool.md
Last active February 3, 2025 02:38
When is Clojure "the right tool for the job"?

My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?

My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.

There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.

That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.

Let's look at some of the dimensions that make a difference and what I think of Clojure for them:

<LoadingButton
ariaErrorAlert={"There was an error creating your account"}
ariaLoadingAlert={
authState === AuthState.CreatingUser
? "Registering account, please wait..."
: authState === AuthState.FulfillingPurchase
? "Generating license, please wait..."
: "Loading..."
}
ariaSuccessAlert="Account created! Redirecting."
@joshkh
joshkh / deploy.clj
Created October 15, 2020 13:17
Deploy Ions to AWS
(ns app.deploy
(:require
[datomic.ion.dev :as dev]
[taoensso.timbre :refer [infof]]))
(defn check-status-loop [{arn :execution-arn :as args}]
(let [{:keys [deploy-status code-deploy-status] :as status}
(dev/deploy-status {:op :deploy-status
:execution-arn arn})]
(if (contains? (set [deploy-status code-deploy-status]) "RUNNING")
@jgcmarins
jgcmarins / babel.config.js
Created April 24, 2020 23:37
Webpack configs for Node.js backends to run both locally and on AWS Lambda
module.exports = {
presets: [
'@babel/preset-react',
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
@olivergeorge
olivergeorge / Makefile
Last active August 13, 2021 02:06
Devops tools for simple Datomic Ions app
provision:
clojure -A:dev -m devops provision
teardown:
clojure -A:dev -m devops teardown
cloud-on:
clojure -A:dev -m devops cloud-on
@yelouafi
yelouafi / algebraic-effects-series-1.md
Last active March 3, 2026 06:22
Operational Introduction to Algebraic Effects and Continuations

Algebraic Effects in JavaScript part 1 - continuations and control transfer

This is the first post of a series about Algebraic Effects and Handlers.

There are 2 ways to approach this topic:

  • Denotational: explain Algebraic Effects in terms of their meaning in mathematics/Category theory
  • Operational: explain the mechanic of Algebraic Effects by showing how they operate under a chosen runtime environment

Both approaches are valuables and give different insights on the topic. However, not everyone (including me), has the prerequisites to grasp the concepts of Category theory and Abstract Algebra. On the other hand, the operational approach is accessible to a much wider audience of programmers even if it doesn't provide the full picture.