Skip to content

Instantly share code, notes, and snippets.

@leonoel
leonoel / deps.edn
Created February 18, 2019 20:17
happy eyeballs
{:paths ["."]
:deps {missionary {:mvn/version "a.3"}}}
@polymeris
polymeris / core.cljs
Last active June 24, 2023 03:39
re-frame + reagent + figwheel app running in the console
(ns hello-react-blessed.core
(:require
[cljs.nodejs :as nodejs]
[reagent.core :as reagent]
[re-frame.core :as rf]
[blessed :as blessed] ; or use neo-blessed
["react-blessed" :as rb]
[ws]))
(defonce logger (reagent/atom []))
@bhb
bhb / README.md
Last active May 15, 2023 01:28
Clojure friendly mode, inspired by https://github.com/slipset/friendly
@hswick
hswick / pca.md
Last active August 23, 2018 12:21
Principal Component Analysis in pure Clojure

Visualizing the Iris with Principal Component Analysis

This post will teach you how to visualize higher dimensional datasets in lower dimensions using Principal Component Analysis. And guess what?! Its all in Clojure! I was inspired to write this because I was curious how Principal Component Analysis worked, and there aren't a lot of data analysis resources out there for Clojure.

The best one I could find was from Data Sorcery https://data-sorcery.org/category/pca/.

Now that blog post was very informative on how to do Principal Component Analysis (will be referring to this as PCA as well) in Clojure. However, when I decided to use it on a larger dataset I got an out of memory exception because the pca function incanter provides requires a matrix as input. The input matrix requires a lot of memory if the dataset is rather large. So I decided to write my own implementation which could calculate the covariance matrix with an input as a lazyseq. That way my input could be as big as I wanted. And learning

@paultopia
paultopia / upload.cljs
Created December 21, 2016 21:50
clojurescript read uploaded text file in browser (derived from https://mrmcc3.github.io/post/csv-with-clojurescript/ )
(ns upload-file.core
(:require [reagent.core :refer [render atom]]
[cljs.core.async :refer [put! chan <! >!]])
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
;; derived from https://mrmcc3.github.io/post/csv-with-clojurescript/
;; and based on reagent-frontend template.
;; dependencies from project.clj in addition to clojure, clojurescript, and reagent:
;; [org.clojure/core.async "0.2.395"]
@xeqi
xeqi / ukanren_transducers.clj
Last active November 13, 2018 06:38
ukanren in almost transducers
(ns ukanren-transducers
(:refer-clojure :exclude [== disj conj]))
(defrecord Lvar [name])
(defn lvar [] (->Lvar (gensym "lvar")))
(defn lvar? [v] (instance? Lvar v))
(def empty-state {})
(defn walk [u s]
@Deraen
Deraen / 00_notes.md
Last active October 1, 2019 08:40
Compojure-api and Buddy
  • (:identity req) is auth backend independent way to access user data
  • login and logout implementation depends on auth backend
  • :current-user doesn't imply that authentication is required, route should also have :auth-rules if authentication is required
@martintrojer
martintrojer / init.el
Last active January 9, 2021 16:12
init.el clojure bits
;; Clojure
(require 'clojure-mode)
(setq auto-mode-alist (cons '("\\.cljs$" . clojure-mode) auto-mode-alist))
(setq inferior-lisp-program "lein repl")
;; clj-refactor
(require 'clj-refactor)
(add-hook 'clojure-mode-hook (lambda ()
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-o")))
@ptaoussanis
ptaoussanis / transducers.clj
Last active December 17, 2021 13:54
Quick recap/commentary: Clojure transducers
(comment ; Fun with transducers, v2
;; Still haven't found a brief + approachable overview of Clojure 1.7's new
;; transducers in the particular way I would have preferred myself - so here goes:
;;;; Definitions
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as:
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation
;; (The `[]` arity is actually optional; it's only used when calling
;; `reduce` w/o an init-accumulator).
@kachayev
kachayev / css-parser.md
Last active November 12, 2022 04:20
Parsing CSS file with monadic parser in Clojure