Skip to content

Instantly share code, notes, and snippets.

View a13's full-sized avatar
🌲
🍺

D.K. a13

🌲
🍺
  • Belgrade, Serbia
View GitHub Profile
@cky
cky / gist:8500450
Last active June 21, 2022 02:25
Guile implementation of Clojure's `#(...)` reader macro, but using `##(...)` instead to avoid conflicting with vectors.
(use-srfis '(1 69))
(read-hash-extend #\#
(lambda (c port)
(define ht (make-hash-table eqv?))
(define (ht-ref key)
(hash-table-ref ht key (lambda ()
(define sym (gensym))
(hash-table-set! ht key sym)
sym)))
(define (hash-key x)
@telent
telent / gist:9742059
Last active May 8, 2024 11:36
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@tonyg
tonyg / monad.rkt
Last active March 30, 2024 09:05
Monads in Racket
#lang racket/base
;; Monads in Racket, including polymorphic bind, return and fail.
;; Haskell-like do-notation.
(provide define-monad-class
(struct-out monad-class)
monad?
gen:monad
monad->monad-class
determine-monad
@gatlin
gatlin / typed-racket-monads.md
Last active December 30, 2023 01:59
A simple definition and demonstration of monads in Typed Racket

What the fuck is a monad?

Or: functor? I 'ardly know 'er!

Monads are difficult to explain without sounding either patronizing or condescending: I would sound patronizing if I came up with some facile analogy and I would be condescending to describe it categorically.

Instead, I'll frame a problem and piece-by-piece solve the problem with what will turn out to be a monad.

@NicolasPetton
NicolasPetton / transducers.el
Last active April 17, 2023 19:32
transducers in Elisp
;;; stream.el --- Implementation of transducers -*- lexical-binding: t -*-
;; Copyright (C) 2015 Nicolas Petton
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: transducer, sequences
;; Version: 1.0
;; Package: transducers
;; Maintainer: nicolas@petton.fr
@darwin
darwin / ping_pong_go.clj
Last active August 15, 2022 11:25 — forked from jmglov/ping_pong_go.clj
Non-blocking version of core.async ping-pong game
(ns ping-pong-go
(:require [clojure.core.async :as async :refer [<! >!]]))
(defn ping [ch]
(println "Ping")
(go
(>! ch :ping)
(<! (async/timeout 500))))
(defn pong [ch]
#scrollToTop {
display: none !important;
}
#stat-blacklisters {
display: block !important;
}
* {
color: #cccccc !important;
background-color: #444444 !important;
-moz-appearance: none !important;
;; add missing ; on mac layout via H-8
(define-key key-translation-map (kbd "H-8") (kbd ";"))
(quail-define-package
"russian-no-windows" "Russian" "RU" nil
"ЙЦУКЕН Russian computer layout"
nil t t t t nil nil nil nil nil t)
;; 1! 2" 3№ 4% 5: 6, 7. 8; 9( 0) -_ =+ \/ ёЁ
;; Й Ц У К Е Н Г Ш Щ З Х Ъ
;; -*- lexical-binding: t -*-
(require 'dash)
(require 's)
(require 'company)
(defun rofi-filter (proc msg)
(backward-delete-char (length company-prefix))
(insert (s-trim msg)))
{:paths ["."]}