This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rlwrap bb -i | |
;; needs babashka beta | |
(defn ^sun.misc.Signal ->signal | |
"Convert a keyword to an appropriate Signal instance." | |
[signal] | |
(sun.misc.Signal. (-> signal name .toUpperCase))) | |
(defn ^Long signal->number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# .git/hooks/commit-msg | |
# | |
# Check for maximum line lengths | |
# | |
# A git hook script to check the commit log message. | |
# Called by "git commit" with one argument, the name of the file | |
# that has the commit message. The hook should exit with non-zero | |
# status after issuing an appropriate message if it wants to stop the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# part one | |
pbpaste | bb -I -e '(->> (-> *input* (#(vector % %)) (update 1 rest)) (apply map <) (filter true?) count)' | |
# part two | |
pbpaste | bb -I -e ' (->> *input* (iterate rest) (take 3) (apply map +) (#(vector % %)) (#(update % 1 rest)) (apply map <) (filter true?) count)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(set! *warn-on-infer* true) | |
(def ^js wifi (js/require "Wifi")) | |
(def ^js http (js/require "http")) | |
(def n (atom 0)) | |
(defn build-response [] | |
(str | |
"<html>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clj -m cljs.main -O advanced -co '{:infer-externs true}' --output-to main.js | |
echo "Upload with" | |
echo "espruino main.js" | |
echo "Or use the Espruino web IDE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DuplicateRecordFields #-} | |
-- how to resolve the duplication in CreateUser, BasicUser and UpdateUser | |
-- without changing everything to `Maybe String`? | |
data Address = Address { street :: String | |
, zip :: String | |
, city :: String | |
, state :: String | |
} deriving (Show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun c6e/pres-forward () | |
(interactive) | |
(let ((saved (point))) | |
(forward-line) | |
(let ((beg (point))) | |
(search-forward-regexp "^;;; " nil t) | |
(if (= beg (point)) | |
(goto-char saved) | |
(progn | |
(recenter 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"version":1,"keyboard":{"keys":[{"id":0,"legend":"Q","state":{"x":0,"y":0,"r":0,"rx":0,"ry":0,"w":1,"h":1,"x2":0,"y2":0,"w2":0,"h2":0},"row":0,"col":0,"keycodes":[{"id":"LT()","fields":[1,{"id":"KC_Q","fields":[]}]},{"id":"KC_F1","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_NO","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]}]},{"id":1,"legend":"W","state":{"x":1,"y":0,"r":0,"rx":0,"ry":0,"w":1,"h":1,"x2":0,"y2":0,"w2":0,"h2":0},"row":0,"col":1,"keycodes":[{"id":"LT()","fields":[3,{"id":"KC_W","fields":[]}]},{"id":"KC_F2","fields":[]},{"id":"KC_MSTP","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","fields":[]},{"id":"KC_TRNS","f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; On my journey into event sourcing in clojure I'm trying different approaches | |
;; of modeling events and event handling in clojure. | |
;; A little ceremony to pay homage to the gods of clojure: | |
(ns handler-protocol | |
(:use clojure.contrib.trace) | |
(:use clojure.pprint) | |
(:use clojure.test)) | |
;; My example problem domain for this will be a very simple sketch of twitter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "bootloader.h" | |
#include "keymap_common.h" | |
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
KEYMAP( // Layer 0 | |
ESC, 1, 2, 3, 4, 5, EQL, // 7 | |
TAB, Q, W, E, R, T, FN1, // 7 | |
LCTRL, A, S, D, F, G, // 6 | |
LSFT, Z, X, C, V, B, FN2, // 7 | |
FN3, NONUS_BSLASH, LCTRL, LALT, LGUI, // 5 L3 |
NewerOlder