Skip to content

Instantly share code, notes, and snippets.

@shaunlebron
shaunlebron / css-typography.md
Last active April 13, 2024 17:07
CSS typography

CSS Typography

We can do typographic things in CSS that we couldn’t before.

Hanging Indent

text-indent: 2em hanging; /* Safari and Firefox only */
@shaunlebron
shaunlebron / flexbox-rosetta.md
Last active April 13, 2024 17:32
Flexbox Rosetta Stone

Flexbox vs Inline alignment

flex-flow: row wrap shows how inline text alignment is a special case of flexbox:

TEXT-ALIGN:         left  | center | right | justify       | __           | __
→ JUSTIFY-CONTENT:  start | middle | end   | space-between | space-around | space-evenly

VERTICAL-ALIGN:     top   | middle | bottom | __
→ ALIGN-SELF: start | center | end | stretch
@shaunlebron
shaunlebron / swift-ui-syntax.md
Created January 3, 2024 19:50
Syntax of a SwiftUI app

Syntax of a SwiftUI app

The structure of a SwiftUI app uses a lot of Swift syntax to appear simple:

import SwiftUI


@main                         // <-- Attribute (potentially an attached macro)
struct MyApp: App {
(defmacro =>>
"Makes ->> faster if the first form is a collection, and the last form is `sequence`, `into`, or `reduce`"
;; adapted from: https://github.com/divs1210/streamer/blob/master/src/streamer/core.clj
[coll & xforms-and-term]
(let [[xforms term] ((juxt butlast last) xforms-and-term)]
(cond
;; sequence
(or (= term 'sequence)
(and (list? term)
(= (first term) 'sequence)))
@shaunlebron
shaunlebron / clojure-core-plus.md
Last active December 1, 2022 15:01
Clojure Core Plus
@shaunlebron
shaunlebron / dark_sheets.css
Last active March 1, 2023 01:56
Google Sheets Dark Mode
/* invert the table, formula bar, cell editor, and navbar
and dim transparency to soften */
#waffle-grid-container,
#formula-bar-name-box-wrapper,
div[role="navigation"],
.cell-input.editable {
filter: invert();
opacity: 0.9;
}
@shaunlebron
shaunlebron / SketchSystems.spec
Last active August 18, 2021 16:51
Super Mario 64 controls
Super Mario 64 controls
Stationary
Standing
move -> Walking
z -> Crouching
a -> Jumping
b -> Punching
Crouching
z up -> Standing
@shaunlebron
shaunlebron / json-hyperscript-hiccup.md
Last active April 25, 2020 20:53
Jsonml, HyperScript, Hiccup
@shaunlebron
shaunlebron / neural-network-altviz.md
Last active December 17, 2019 11:20
alternative visualization for neural networks

Neural Network Alt Viz

Use both scalar and vector nodes to simplify presentation and clarify computation (by linear algebra).

The weighted edges are replaced by two layers of vector nodes:

  1. the first collects the previous neuron scalars into a vector
  2. the second is a weight rack (a matrix), each vector containing all the weights for a neuron

Showing a single path to illustrate computation along its edges:

@shaunlebron
shaunlebron / beautiful-printing.md
Last active November 16, 2021 00:38
Print beautiful articles (with HTML to LaTeX)

Print Beautiful Articles (with HTML to LaTeX)

It’s hard to read long articles on a computer. Printing them with beautiful typesetting helps.

This solution converts the whole article (or selected part) to LaTeX, then opens it for printing (or editing) in Overleaf. You need an account there, but no installs.

Images

Images are included in the LaTeX code, but won’t show up until you upload them individually to Overleaf. Look for the \includegraphics commands which are commented out in the code, and refer here for proper insertion.