Skip to content

Instantly share code, notes, and snippets.

View russmatney's full-sized avatar

Russell Matney russmatney

View GitHub Profile
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Reflection;
using System.IO;
using System.Text;
public class EditorFontResizer : EditorWindow {
@borkdude
borkdude / bipe
Last active April 9, 2024 21:21
vipe for babashka - see https://github.com/juliangruber/vipe
#!/usr/bin/env bash
# temp file
t=/tmp/bipe.$$.txt
touch $t
# read from stdin
if [ ! -t 0 ]; then
cat > $t
@just-sultanov
just-sultanov / bb.edn
Last active January 8, 2022 18:18
Typical project tasks using babashka
{: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
@oliyh
oliyh / debounce.clj
Last active February 17, 2024 22:34
Debounce in Clojure on the JVM
(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]
@sjvnnings
sjvnnings / better_jumping_character_example.gd
Last active June 4, 2024 12:30
An easy to work with jump in Godot
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
@hugcis
hugcis / publish.el
Created June 16, 2021 14:08
Elisp script with functions to export my notes to Hugo-markdown with ox-hugo
;;; 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"
@stelcodes
stelcodes / bb-postgresql-backup-restore.edn
Last active July 1, 2022 05:20
Babashka Tasks for PostgreSQL Backups
; 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)},
@borkdude
borkdude / transit_arrays.clj
Created May 19, 2021 17:20
Handling arbitrary array types with transit
;; 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))
@amygrinn
amygrinn / settings.org
Last active March 24, 2021 20:47
Literate configuration columns view

About

Use column view (C-c C-x C-c) to edit the settings file. Once done, use org-babel-tangle (C-c C-v t) to install to you init file. You can quit column view by putting point in any cell and pressing ‘q’

The machine name can be retrieved by running eval-expression (M-:) and calling (system-name). You can also set the system name using the

@holyjak
holyjak / http-server.bb
Last active June 5, 2024 10:00
Babashka HTTP server for serving static files, similar to `python -m http.server` but more flexible :)
#!/usr/bin/env bb
#_" -*- mode: clojure; -*-"
;; Based on https://github.com/babashka/babashka/blob/master/examples/image_viewer.clj
(ns http-server
(:require [babashka.fs :as fs]
[clojure.java.browse :as browse]
[clojure.string :as str]
[clojure.tools.cli :refer [parse-opts]]
[org.httpkit.server :as server]