Skip to content

Instantly share code, notes, and snippets.

View axehomeyg's full-sized avatar

Michael Cerna axehomeyg

View GitHub Profile
@axehomeyg
axehomeyg / core.clj
Last active September 26, 2023 07:09
Numpy-like index/slice accessors for Clojure
(ns numpy-wannabe.core
(:gen-class)
(:require [clojure.edn :as edn]
[clojure.string :as str]))
;;;;;;;; Helper Functions
(defn gsub [matcher replacer value]
(str/replace value matcher replacer))
(defn nths [row, columns]
@axehomeyg
axehomeyg / sqlite_test_db_loader.rb
Created December 9, 2019 20:27
Rails 6 parallel minitest with sqlite3 :memory: databases.
#### evals the schema into the current process
class SqliteTestDbLoader
# assumes your schema is generated for MySQL
# tweak for Postgres!
MYSQL_REPLACEMENTS = {
/ENGINE=InnoDB DEFAULT CHARSET=[a-z0-9]*/ => '',
/, collation: "[^"]*"/ => ''
}