Skip to content

Instantly share code, notes, and snippets.

View pbzdyl's full-sized avatar
😎

Piotrek Bzdyl pbzdyl

😎
View GitHub Profile

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@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

@RichardForrester
RichardForrester / init.lua
Last active September 26, 2018 01:06
Karabiner Elements and Hammerspoon on MacOS Sierra
-- ln -s ~/repos/config/init.lua ~/.hammerspoon/init.lua
-- Global variable for the Command Mode
cMode = hs.hotkey.modal.new({}, "F17")
-- Global variable for Delete Mode
dMode = hs.hotkey.modal.new({}, 'F20')
-- Global variable for Select Mode
sMode = hs.hotkey.modal.new({}, 'F19')
@ttscoff
ttscoff / init.lua
Last active January 9, 2024 23:44
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)
(ns ui.form
(:refer-hoplon :exclude [select input textarea label form])
(:require [ui.form.input :as input]
[ui.button :as button]
[ui.modal :as modal]
[ui.grid :as grid]
[ui.filters :as filters]
[ui.link :as link]
[ui.util :as util]
[ui.icon :as icon]
@micha
micha / throttle.cljs.hl
Last active October 30, 2016 02:23
Create a cell that only updates at most once every so many milliseconds
(defn throttle [c ms]
(let [queued? (atom false)]
(with-let [ret (cell @c)]
(add-watch c (gensym)
#(when-not @queued?
(reset! queued? true)
(with-timeout ms
(reset! queued? false)
(reset! ret @c)))))))
@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

alan@alanputer:~/Desktop$ tree
.
└── jars
└── upcase-2.0.0.jar
1 directory, 1 file
alan@alanputer:~/Desktop$ boot repl
nREPL server started on port 50498 on host 127.0.0.1 - nrepl://127.0.0.1:50498
REPL-y 0.3.5, nREPL 0.2.8
Clojure 1.6.0
@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@nblumoe
nblumoe / vim_fireplace_paredit_cheat_sheet.md
Created April 24, 2013 06:41
Simple cheat sheet for vim fireplace and paredit

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window