Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / realtalk.md
Last active March 25, 2024 15:26
why Dynamicland Realtalk isn't open source

Transcribed from an interview with Toby Schachman and Paula Te on The Afrofuturist Podcast:

There's this notion of the open-source movement. There are a lot of things
that we totally resonate with that because it's about understanding how your
technology works. We're totally 100% on board with that.

But then there are other issues with the open-source community, where it's
very internet-based and so open-source ends up benefitting this group of
people who have really strong access to internet and understand how to use
@shaunlebron
shaunlebron / angleLerp.js
Created February 5, 2014 20:41
The best way to interpolate 2D angles
/*
2D Angle Interpolation (shortest distance)
Parameters:
a0 = start angle
a1 = end angle
t = interpolation factor (0.0=start, 1.0=end)
Benefits:
1. Angles do NOT need to be normalized.
@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 {
@shaunlebron
shaunlebron / _README.md
Last active December 3, 2023 08:58
Direct3D9 Wrapper DLL

In response to a StackOverflow question:

This is code to build a Direct3D wrapper DLL, intercepting all calls to Direct3D interface functions so that you can draw your own objects to display over the game. Just plop the DLL into the same folder as the game's executable, and it should load it as if it were the real d3d9.dll file. It still forwards all calls to the real one in system32, just allows stuff to happen in between. original stackoverflow answer

@shaunlebron
shaunlebron / halo.md
Last active September 4, 2023 06:00

I spent a lot of time in high school and college (2005-07) modifying the game Halo—a dark art I learned by finding experts willing to teach me.

I first approached David Skotnicki (TocaEdit) to ask how he added a knob to the Field of View in Halo. He taught me how to use TSearch and Cheat Engine to analyze the effects of in-game actions on locations in memory, how to find locations in code which accessed its values, how to reroute the game to use custom code, and how to package the edits into a VB6 app for distribution.

I set out to use this for a bit of vanity—to keep the camera floating behind

@shaunlebron
shaunlebron / README.md
Created May 31, 2012 15:00
Iterating Combinations

Iterating Combinations

If you're trying to iterate all combinations of k=5 on n=36, this is how you loop through them.

int k = 5;
int n = 36;
int count = 0;
for (int i1=1; i1 &lt;= n-k+1; i1++)
(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 / 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;
}