This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn distinct-p | |
([pred coll] | |
(distinct-p pred coll #{})) | |
([pred coll seen] | |
(if (empty? coll) | |
'() | |
(lazy-seq | |
(let [next (first coll) | |
key (pred next) | |
is-dup (contains? seen key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.spec.alpha :as s]) | |
(s/def ::defreloadable-args | |
(s/cat :name simple-symbol? | |
:doc (s/? string?) | |
:attr-map (s/? map?) | |
:fn-tails (s/+ any?))) | |
(defmacro defreloadable | |
"Defines a new function as [[defn]], but old references will refer to new versions when reloaded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if UNITY_EDITOR | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using System.Reflection; | |
using System.IO; | |
using System.Text; | |
public class EditorFontResizer : EditorWindow { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# temp file | |
t=/tmp/bipe.$$.txt | |
touch $t | |
# read from stdin | |
if [ ! -t 0 ]; then | |
cat > $t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:min-bb-version "0.6.1" | |
:tasks | |
{:requires ([babashka.fs :as fs] | |
[babashka.process :as proc] | |
[clojure.string :as str] | |
[clojure.pprint :as pprint]) | |
;; Helpers | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[java.util Timer TimerTask]) | |
(defn debounce | |
([f] (debounce f 1000)) | |
([f timeout] | |
(let [timer (Timer.) | |
task (atom nil)] | |
(with-meta | |
(fn [& args] | |
(when-let [t ^TimerTask @task] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends KinematicBody2D | |
export var move_speed = 200.0 | |
var velocity := Vector2.ZERO | |
export var jump_height : float | |
export var jump_time_to_peak : float | |
export var jump_time_to_descent : float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; publish --- Summary | |
;;; Commentary: | |
(require 'find-lisp) | |
;;; Code: | |
(defun hugcis/publish-note (file) | |
"Publish a note in FILE." | |
(with-current-buffer (find-file-noselect file) | |
(projectile-mode -1) | |
(setq org-hugo-section "notes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; run `bb backup` to backup database | |
; run `bb restore` to restore latest backup | |
{:min-bb-version "0.4.0", | |
:tasks {; CONSTANTS | |
db-name "dev_blog", | |
backup-dir "backups", | |
now (str (java.time.LocalDateTime/now)), | |
; TASKS | |
create-backup-dir {:depends [backup-dir], :task (babashka.fs/create-dirs backup-dir)}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; clojure -Sdeps '{:deps {com.cognitect/transit-clj {:mvn/version "RELEASE"}}}' -M /tmp/transit_arrays.clj | |
(require '[cognitect.transit :as transit]) | |
(def default-write-handler | |
(transit/write-handler (fn [x] | |
(when (.isArray (class x)) | |
"java.array")) | |
(fn [x] | |
(when (.isArray (class x)) |