Skip to content

Instantly share code, notes, and snippets.

@leifp
leifp / pythonReadabilityFactoryPattern.md
Created December 16, 2024 03:02
Perfect Python Readability Enhancer

Python readability enhancer

all prose is written in "space case" (all lowercase, words separated by spaces) for clarity.

inspired by projects like bython and pygyat that attempt to enhance the readability of the python language, i've created a tool to display your python files in a more readable format. i've only tested it on ubuntu x86_64, but it should work on all known or imagined os and cpu combinations. here's how i evolved your new favorite tool.

@leifp
leifp / fns.clj
Last active June 16, 2016 19:01
clojure.spec's for clojure.core
;; moved to https://github.com/leifp/spec-play
;; src/spec/clojure/fns.clj
@leifp
leifp / 0001-index-papers-by-canvas-region.patch
Last active August 29, 2015 14:21
Ideas on amithgeorge/reddit-dailyprogrammer-clojure 214_intermediate.clj
From 82dab3592fcc4f51fa2ce25133617502b1671429 Mon Sep 17 00:00:00 2001
From: Leif Poorman <[email protected]>
Date: Sun, 17 May 2015 20:30:12 -0400
Subject: [PATCH 1/3] index papers by canvas region
---
src/rdp/214_intermediate.clj | 87 +++++++++++++++++++++++++++++++++-----------
1 file changed, 66 insertions(+), 21 deletions(-)
diff --git a/src/rdp/214_intermediate.clj b/src/rdp/214_intermediate.clj
@leifp
leifp / test-multiple-impls.clj
Created March 25, 2015 01:18
Best way to test multiple implementations of a protocol?
(ns test.multiple.implementations
(:require [clojure.test :refer [deftest is]]))
;;; Protocol and records that implement it
(defprotocol P (value [this]))
(defrecord One [] P (value [_] 1))
(defrecord Three [] P (value [_] 3))
;; potentially several more...
@leifp
leifp / diamond.clj
Created December 9, 2014 04:12
Solution to diamond kata
(ns diamond
(:require [clojure.string :as s]
[clojure.test :refer [deftest is]]))
(defn palindrome
[coll]
(concat coll (reverse (butlast coll))))
(defn char-range
[start-c end-c]
@leifp
leifp / gist:b4af5f4cd7289c38b55a
Last active August 29, 2015 14:01
core.logic solution to the Mensa Puzzle Calendar puzzle for April 8, 2014
(require '[clojure.core.logic :refer :all])
(require '[clojure.core.logic.fd :as fd])
(defn more-than-one-apart [x y]
(conde
[(fd/eq (> (- x y) 1))]
[(fd/eq (> (- y x) 1))]))
(defn billiards []
(let [dom (fd/interval 1 10)