Skip to content

Instantly share code, notes, and snippets.

// the `unknown` type is similar to `any`, except it is less permissive on the RHS of assignment
let unknownType: unknown = 'asdf'
let anyType: any = 'asdf';
let someString: string;
// now,
someString = anyType;
// is permitted, while
// someString = unknownType
// errors
@ransomw
ransomw / home.cljs
Created October 19, 2017 16:29
Rum willReceiveProps-like substitute
(ns feels.ui-comp.home
(:require
[rum.core :as rum]
[citrus.core :as citrus]
[feels.ui-comp.emoji :as emoji]
))
(rum/defcs home <
{:will-mount
@ransomw
ransomw / wicd_err_01.md
Last active July 3, 2017 11:54
capture portal (01)

wicd + wicd-curses / iw + dhclient

attempts at connecting to a capture portal for login via web browser with two different client setups, or what happened when wicd didn't ''just work''

iw + dhclient

# iw dev wlan0 connect -w "$host"
wlan0 (phy #0): connected to 4a:f8:b3:ce:36:17
@ransomw
ransomw / fp_snippets.clj
Created January 22, 2017 05:36
functional programming clojure snippets
;; helper that's like clojure.core/partial, except
;; it partially applies the function to its args in reverse order
(defn partial-reverse [f & partial-args]
(comp
(partial
apply
(apply partial
(cons (comp (partial apply f) reverse list)
partial-args)))
reverse list))
@ransomw
ransomw / EMBER_100115.md
Last active November 11, 2019 07:48
ember_100115

initial attempts at programmatic ember-cli usage

test-a is a directory parallel to these files where ember init was run and bower.json was edited to include jquery at 1.11.3 exactly as ember throws an error on jquery 1.12.x.

the js generated by node build.js contains

require("undefined/app")["default"].create({});

suggesting that this setup leaves a variable needed by the ember-cli build system undefined.