Skip to content

Instantly share code, notes, and snippets.

@dtipson
dtipson / IO plus Array & Promise helpers.js
Last active August 26, 2024 01:15
Bare bones FP type utility lib so we can play around with functions that capture the composition of DOM read/writes, but in a pure way
// Let's make it possible to create pure functions even when we're
// dealing with impure operations that would have side effects!
// First we'll need a "Type" that can contain a (sometimes impure) function
function IO(fn) {
if (!(this instanceof IO)) {//make it simpler for end users to create a type without "new"
return new IO(fn);
}
this.runIO = fn;//IO now provides an extra control layer that allows the composition of unexecuted effects
@safiire
safiire / dual.h
Created October 11, 2016 02:08
My Dual Number implementation
#pragma once
#include <iostream>
#include <cmath>
#include <limits>
#include "saf_math.h"
//// Some more information for adding more functionality here:
//// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/other/dualNumbers/functions/
@cstby
cstby / cider-eval-n-defuns.md
Last active January 17, 2022 23:12
Faster feedback in Clojure with `cider-eval-n-defuns`.

Summary

You can use this Emacs function to easily evaluate multiple top-level forms in Clojure using CIDER.

(defun cider-eval-n-defuns (n)
  "Evaluate N top-level forms, starting with the current one."
  (interactive "P")
  (cider-eval-region (car (bounds-of-thing-at-point 'defun))
                     (save-excursion
 (dotimes (i (or n 2))