Skip to content

Instantly share code, notes, and snippets.

View frenchy64's full-sized avatar

Ambrose Bonnaire-Sergeant frenchy64

  • Madison, Wisconsin
View GitHub Profile
@ericnormand
ericnormand / 00_script.clj
Last active January 6, 2024 07:13
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@X-Raym
X-Raym / Parent script.lua
Last active July 19, 2023 09:52
Custom ReaScripts Preset Files
--[[
* ReaScript Name: Parent script
* About: For devs
* Author: X-Raym
* Author URI: https://www.extremraym.com
* Repository: X-Raym/REAPER-ReaScripts
* Licence: GPL v3
* REAPER: 5.0
* Version: 1.0
--]]
object TransducerUniversal {
type Reduct[-A, R] = (R, A) => R
trait Trans[+A, -B] { def apply[R](f: Reduct[A, R]): Reduct[B, R] }
def map[A, B](f: A => B): Trans[B, A] = new Trans[B, A] { def apply[R](rf: Reduct[B, R]) = (r, a) => rf(r, f(a)) }
def filter[A](p: A => Boolean): Trans[A, A] = new Trans[A, A] { def apply[R](rf: Reduct[A, R]) = (r, a) => if (p(a)) rf(r, a) else r }
def comp[A,B,C](t1 : Trans[A, B], t2 : Trans[C, A]): Trans[C, B] = new Trans[C, B] { def apply[R](rf: Reduct[C, R]) = t1(t2(rf)) }
def sequence[A, B](t: Trans[B, A], data: Seq[A]) = data.foldLeft(Seq[B]())(t(_ :+ _))
implicit class Compable[A,B](t1: Trans[A, B]) {
@dysinger
dysinger / idris-ubuntu-12.04.md
Last active August 29, 2015 13:56
Install Idris (latest) on Ubuntu 12.04

Install GHC & Cabal-Install

apt-get update
apt-get install -y zlib1g-dev libncurses5-dev ghc cabal-install happy alex

Update Cabal-Install

cabal update
cabal install cabal-install

export PATH=$HOME/.cabal/bin:./.cabal-sandbox/bin:$PATH

@richhickey
richhickey / thread.clj
Created October 13, 2012 17:43
new thread macros draft
(defmacro test->
"Takes an expression and a set of test/form pairs. Threads expr (via ->)
through each form for which the corresponding test expression (not threaded) is true."
[expr
& clauses]
(assert (even? (count clauses)))
(let [g (gensym)
pstep (fn [[test step]] `(if ~test (-> ~g ~step) ~g))]
`(let [~g ~expr
~@(interleave (repeat g) (map pstep (partition 2 clauses)))]
@asabaylus
asabaylus / gist:3071099
Created July 8, 2012 14:12
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@swannodette
swannodette / gist:2719676
Created May 17, 2012 15:35
unify_datums.clj
(ns datomic-play.core
(:use [datomic.api :only [db q] :as d])
(:require [clojure.core.logic :as l]
[clojure.pprint :as pp]))
(def uri "datomic:dev://localhost:4334/hello")
(defprotocol IUnifyWithDatum
(unify-with-datum [u v s]))
(defn analysis->map
"Convert Java Object expr into nested maps"
; result type:
; (rec X (U {:op :def
; :env {:source Object
; :line Object}
; :var Var}
; {:op :if
; :env {:source Object
; :line Object}
@jlongster
jlongster / gist:1712455
Created January 31, 2012 19:37
traditional lisp macros
;; outlet code for implementing traditional macro expansion
;; macros
(define (expand form)
(cond
((variable? form) form)
((literal? form) form)
((macro? (car form))
(expand ((macro-function (car form)) form)))
@swannodette
swannodette / gist:1408092
Created November 30, 2011 05:00
project.clj
(defproject clojurescript "0.1.0-SNAPSHOT"
:source-path "src/clj"
:dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]])