Skip to content

Instantly share code, notes, and snippets.

View stathissideris's full-sized avatar

Stathis Sideris stathissideris

  • London
View GitHub Profile
@gfredericks
gfredericks / bijections.clj
Created March 19, 2018 17:07
Half a draft of bijections in clojure
(ns user.bijections
(:refer-clojure :exclude [-> comp update])
(:require [clojure.core :as core]
[clojure.set :as set])
(:import (java.util UUID)))
;;
;; Motivation:
;;
;; - avoid the edge cases inherent in allowing multiple
@dkozma
dkozma / inspect.clj
Last active August 13, 2017 22:38
Clojure->Chrome Inspector
(ns inspect
(:require [cheshire.core :refer [generate-string]]
[clojure.java.io :as io])
(:import (java.net Socket)
(def host "localhost")
(def port 9000)
(defn cinspect [data]
(with-open [sock (Socket. host port)
@reborg
reborg / rich-already-answered-that.md
Last active February 23, 2024 13:09
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@kennyjwilli
kennyjwilli / defspec-test.clj
Created November 5, 2016 01:37
clojure.spec.test integration with clojure.test
(defmacro defspec-test
([name sym-or-syms] `(defspec-test ~name ~sym-or-syms nil))
([name sym-or-syms opts]
(when t/*load-tests*
`(def ~(vary-meta name assoc :test `(fn []
(let [check-results# (clojure.spec.test/check ~sym-or-syms ~opts)
checks-passed?# (every? nil? (map :failure check-results#))]
(if checks-passed?#
(t/do-report {:type :pass
:message (str "Generative tests pass for "
@Risto-Stevcev
Risto-Stevcev / spectest.cljs
Last active October 31, 2019 18:53
Some functions to help integrate clojure.spec.test/check with cljs.test/deftest
(ns foo-test
(:require [cljs.spec :as s]
[cljs.spec.test :as stest]
[clojure.pprint :as pprint]
[cljs.test :refer-macros [deftest is]]))
;; Sample function and a function spec
(defn fooo [i] (+ i 20))
(s/fdef fooo
@Deraen
Deraen / spec-coercion.clj
Created June 14, 2016 15:47
Clojure.spec coercion test
(ns spec-test.core
(:require [clojure.spec :as s]))
(defn x-integer? [x]
(if (integer? x)
x
(if (string? x)
(try
(integer/parseint x)
(catch exception e
@jindrichmynarz
jindrichmynarz / dub_techno_in_sonic_pi.rb
Created December 8, 2015 19:11
Dub techno in Sonic Pi
use_debug false
use_bpm 130
# Our mixer!
master = (ramp *range(0, 1, 0.01))
kick_volume = 1
bass_volume = 1
revbass_volume = 1
snare_volume = 0.5
hats_volume = 0.5
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.