Skip to content

Instantly share code, notes, and snippets.

View LizAinslie's full-sized avatar
⚒️
BUILD COOL SHIT BUILD COOL SHIT BUILD COOL SHIT

Liz Ainslie LizAinslie

⚒️
BUILD COOL SHIT BUILD COOL SHIT BUILD COOL SHIT
View GitHub Profile
// Define a trait function to that expects behavior to convert a value to type T
trait fun to<T>(): T
// So you want to require a property? Use a trait getter!
trait fun(get) displayName: String
// You can define a tuple type with parenthesis
tuple Name (String, String) {
|(first, last)| impl fun to<String>() = "${first} ${last}"
@LizAinslie
LizAinslie / stacky.ts
Last active January 27, 2024 04:07
Stacky bois
const stackCount = 10
const STACK_SPACE = 10;
// Draw the stack of images
for (let i = 0; i < stackCount; i++) {
const shearFactor = (stackCount - i)
// Calculate scale and position adjustments based on the current iteration
const scaleAdjustment = 0.9 + (0.1 * (i - shearFactor)) / stackCount
const positionAdjustmentX = (scaledImageWidth - (scaledImageWidth * scaleAdjustment)) / 2;
const positionAdjustmentY = (STACK_SPACE * shearFactor);