Skip to content

Instantly share code, notes, and snippets.

Ian Truslove iantruslove

Block or report user

Report or block iantruslove

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View core.clj
(ns specfoo.core
(:require [clojure.spec.gen.alpha :as gen]
[clojure.spec.alpha :as s]))
(distinct (remove coll? (gen/sample (s/gen any?) 100)))
@iantruslove
iantruslove / profiles.clj
Last active Jan 20, 2018
Clojure debugging: local setup
View profiles.clj
;; ~/.lein/profiles.clj
{:user {:source-paths ["/Users/ian/.lein/src"]
:injections [(require 'spyscope.core)]
:dependencies [[evalive "1.1.0"]
[spyscope "0.1.7-SNAPSHOT"]]
}}
@iantruslove
iantruslove / patch-sexp-fu.txt
Created Jun 28, 2017
Fixing the "‘preceding-sexp’ is an obsolete function (as of 25.1)" emacs startup error
View patch-sexp-fu.txt
Check out this (sadly unmerged) PR:
https://github.com/hchbaw/eval-sexp-fu.el/pull/3/files
replacing preceding-sexp with elisp--preceding-sexp by danielschranz · Pull Request #3 · hchbaw/eval-sexp-fu.el
This is to avoid the obsolete warning in Emacs 25.1 (see: http://doc.endlessparentheses.com/Fun/preceding-sexp.html)
find your eval-sexp-fu source file, and patch it - there's 2 replacements of preceding-sexp with elisp--preceding-sexp
the file is something like ~/.emacs.d/elpa/eval-sexp-fu-20131230.1351/eval-sexp-fu.el
@iantruslove
iantruslove / Den-of-Clojure-intro-1-talk.md
Last active Apr 21, 2016
Den of Clojure - Intro to Clojure part 1
View Den-of-Clojure-intro-1-talk.md

A gentle introduction to Clojure

Lisp Cycles (XKCD 297 / https://xkcd.com/297/)

Ian Truslove

Den of Clojure

2016-04-21


View noco-webscale-clojure-intro-talk.md

A gentle introduction to Clojure

Lisp Cycles (XKCD 297 / https://xkcd.com/297/)

Ian Truslove

NoCo Web Scale

2015-12-01


@iantruslove
iantruslove / math-test.clj
Last active Oct 13, 2015
Numerically stable math
View math-test.clj
(ns jupiter.test.utils.math
(:require [clojure.test :refer :all]
[jupiter.utils.math :refer :all]))
(defn float=
([x y] (float= x y 0.000001))
([x y epsilon]
(let [scale (if (or (zero? x) (zero? y)) 1 (Math/abs x))]
(<= (Math/abs (- x y)) (* scale epsilon)))))
@iantruslove
iantruslove / DoC-sep-2015-Jupiter.org
Last active Sep 10, 2015
Den of Clojure | Real Projects | Jupiter
View DoC-sep-2015-Jupiter.org

Den of Clojure

REAL PROJECTS

Jupiter

Den of Clojure, 2015-09-10

Ian Truslove@iantruslove

@iantruslove
iantruslove / StopAnalyzer.java
Created May 11, 2015
English stop words in Lucene (lucene-5.1.0/analysis/common/src/java/org/apache/lucene/analysis/core/StopAnalyzer.java)
View StopAnalyzer.java
static {
final List<String> stopWords = Arrays.asList(
"a", "an", "and", "are", "as", "at", "be", "but", "by",
"for", "if", "in", "into", "is", "it",
"no", "not", "of", "on", "or", "such",
"that", "the", "their", "then", "there", "these",
"they", "this", "to", "was", "will", "with"
);
final CharArraySet stopSet = new CharArraySet(stopWords, false);
ENGLISH_STOP_WORDS_SET = CharArraySet.unmodifiableSet(stopSet);
@iantruslove
iantruslove / gorilla-repl-helpers.el
Last active Aug 29, 2015
Emacs function to remove results from a Gorilla REPL clojure notebook file
View gorilla-repl-helpers.el
(defun gorilla-empty-all-results* ()
(while (re-search-forward
";; @@\n\\(;; ->\n\\)?\\(;;;.*\n\\)*\\(;; <-\n\\)?;; =>\n\\(;;;.*\n\\)+;; <="
nil t)
(replace-match ";; @@")))
(defun gorilla-empty-all-results ()
"Empty all Gorilla REPL result blocks"
(interactive)
(save-excursion
You can’t perform that action at this time.