Skip to content

Instantly share code, notes, and snippets.

@xeqi
xeqi / sudoku.clj
Last active August 29, 2015 14:21
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic)
(:require [clojure.core.logic.fd :as fd]))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
(defrecord JimFSFactory []
component/Lifecycle
(start [t] (Jimfs/newFileSystem (Configuration/unix))))
(extend-protocol component/Lifecycle
Jimfs
(stop [t] (.close t)))
(defrecord PathFactory [fs]
component/Lifecycle
(defrecord JimFSFactory []
component/Lifecycle
(start [t] (Jimfs/newFileSystem (Configuration/unix))))
(extend-protocol component/Lifecycle
Jimfs
(stop [t] (.close t)))
(defrecord PathFactory [fs]
component/Lifecycle
@xeqi
xeqi / ukanren_transducers.clj
Last active November 13, 2018 06:38
ukanren in almost transducers
(ns ukanren-transducers
(:refer-clojure :exclude [== disj conj]))
(defrecord Lvar [name])
(defn lvar [] (->Lvar (gensym "lvar")))
(defn lvar? [v] (instance? Lvar v))
(def empty-state {})
(defn walk [u s]
@xeqi
xeqi / macro.js
Created December 7, 2023 14:31
Battle stats update macro
const enemyTokens = game.canvas.scene.tokens.filter(entry => entry.disposition == -1);
const enemyDrawings = [
// Name, Amount
["0HRRJvAy0DL9fZYj", "xOkLUlaf66MIWaEg"],
["fvEtY6HXxuWZwTaM", "3ZpYPphDlKP0qocJ"],
["BxYhCFss1Hxeubg1", "1cyj6HHCq1Dy5y9C"],
["0zVx7PfduwZbNqnj", "kkoOJOPxo6K8hIhV"],
].map(uis => uis.map(id => canvas.scene.drawings.get(id)));