Skip to content

Instantly share code, notes, and snippets.

View lambdahands's full-sized avatar
🔮
~*srcery*~

Amani lambdahands

🔮
~*srcery*~
View GitHub Profile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@branneman
branneman / better-nodejs-require-paths.md
Last active January 30, 2024 04:32
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
@gorsuch
gorsuch / gist:1418850
Created December 1, 2011 18:37
clojure uuid
(defn uuid [] (str (java.util.UUID/randomUUID)))
;; # Maria for Experts
;; This is a short tour of abstractions we've made in the process of building Maria, which are also available while using the system. It is meant for people with experience using functional programming languages who already know how to evaluate forms in Maria. If you're a beginner to Maria or to programming in general, I recommend starting [here](https://www.maria.cloud/intro).
;; (For the impatient, Command-Enter — Control-Enter on a PC — within a code block with evaluate the code before the cursor.)
;; ## Notebook interface
;;
;; In the notebook tradition exemplified by iPython Notebooks, one has a mix of prose and code with the ability to visualize the results of evaluating a particular piece of code.
;;
@mrb
mrb / abstint.md
Last active October 4, 2020 18:45
"Programs that eat programs" Works cited/bibliography
@malyn
malyn / vim-fireplace-figwheel.diff
Created February 20, 2015 21:12
vim-fireplace patches/hack for compatibility with Figwheel
diff --git a/plugin/fireplace.vim b/plugin/fireplace.vim
index 6c32caa..a415bf8 100644
--- a/plugin/fireplace.vim
+++ b/plugin/fireplace.vim
@@ -232,7 +232,9 @@ function! s:repl.piggieback(arg, ...) abort
else
let arg = ' :repl-env ' . a:arg
endif
- let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
+ "let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
@Sh4pe
Sh4pe / README.md
Last active April 11, 2018 05:39
Pretty-print methods of a Java class in Clojure. Useful inside the REPL.

The function print-methods is intended to be used inside a REPL. Just copy and paste it to your REPL and enjoy:

main=> ; paste print-methods
main=> (print-methods 1)
class java.lang.Long
-----------
bitCount(long) -> int
byteValue() -> byte
compare(long, long) -&gt; int
@jackrusher
jackrusher / rhyming-and-scheming.clj
Created January 26, 2014 22:42
Finding rhymes with clojure and CMU's pronunciation dictionary. Tested with this file, minus comments, as 'cmudict.txt': http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict.0.7a
(def rhyme-txt
(map #(string/split % #"[ ]+") (string/split-lines (slurp "cmudict.txt"))))
(def word-to-rhyme
(reduce (fn [m [word & rhyme]]
(assoc m
(string/lower-case word)
(mapv #(keyword (string/replace %1 #"[0-9]" "")) (reverse rhyme))))
{} rhyme-txt))
(ns interop.core
(:require [cljs.nodejs :as nodejs]))
(nodejs/enable-util-print!)
(def Immutable (js/require "immutable"))
(extend-type Immutable.List
ISeqable
(-seq [coll]