Skip to content

Instantly share code, notes, and snippets.

View AlexJWayne's full-sized avatar
🌈

Alex Wayne AlexJWayne

🌈
View GitHub Profile
@AlexJWayne
AlexJWayne / luscura-demo-bootstrap.ts
Created September 21, 2026 03:52
Luxscura sneak peak
const root = await tgpu.init()
const context = root.configureContext({ canvas })
const depthTexture = root
.createTexture({
size: [canvas.width, canvas.height],
format: 'depth24plus',
})
.$usage('render')
@AlexJWayne
AlexJWayne / createInvocationCache.ts
Last active September 7, 2026 07:36
createInvocationCache
import tgpu from 'typegpu'
import { type AnyData, type InferGPU, u32 } from 'typegpu/data'
/**
* Creates a cache for values computed at most once per shader invocation.
* Each cache supports up to 32 values.
*/
export function createInvocationCache() {
const hasValueMask = tgpu.privateVar(u32)
let nextBit = u32(0)
// exported types will be available for you to import from compiled files
// to distinguish between objects ({}) and blocks, blocks have a colon before the opening brace (:{})
export type parseRoute = (route: string) => :{
// assign computations to variables like this
let parts = route.split("/"); // -> ["users", "<id:string>", "posts", "<index:number>"]
// last expression is the return value, like in Rust
parts
// method chaining!
.filter((part) => part.startsWith("<")) // -> ["<id:string>", "<index:number>"]
export * from './types'
import { setHost, setApiKey } from './req'
import * as auth from './api/auth'
import * as blocks from './api/blocks'
import * as costCodes from './api/cost-codes'
import * as equipment from './api/equipment'
import * as reporting from './api/reporting'
import * as sites from './api/sites'
import React, { useState, useEffect } from 'react'
import ItemList from './item-list'
export const CurrentItems = React.createContext([])
const api = {
async getItems() {
return parseItemsOrWhatev(fetch('http://foo.com/items'))
}
}
# same as Ch5_1b (loops with user input list of numbers generating the count, total and average) but with max and min values instead of count aveage and total
# Setting the running smallest and largest numbers to none so they are defined
smallest_number = None
largest_number = None
# User input loop
while True:
string_number = input('Enter a number.')
# Denoting end of loop with 'done' and printing output of smallest and largest numbers from user list
# This program asks for a decimal value and calculates the corresponding
# letter grade.
# Ask the user for the score.
score_as_string = input('Please enter score between 0 and 1: ')
# Convert the string returned by input() to a number.
try:
score = float(score_as_string)
except:
Compiling code for electron
Including:
/Users/alex/Projects/tower/tower.ino
/Users/alex/Projects/tower/FastLED/bitswap.h
/Users/alex/Projects/tower/FastLED/chipsets.h
/Users/alex/Projects/tower/FastLED/color.h
/Users/alex/Projects/tower/FastLED/colorpalettes.h
/Users/alex/Projects/tower/FastLED/colorutils.h
/Users/alex/Projects/tower/FastLED/controller.h
var resize_interval;
// resize AFTER resize finished, and don't do again for a second or so
window.onresize=function(){
// Window was resized, so cancel any previous deferred resize handlers.
clearTimeout(resize_interval);
// Call this every 750ms
resize_interval = setTimeout(function () {
var resize_blocker = Date.now();
var resize_interval;
// resize AFTER resize finished, and don't do again for a second or so
window.onresize=function(){
// window was resized, so cancel any previous deferred resize handlers.
clearTimeout(resize_interval);
// Call this every 250ms
resize_interval = setTimeout(function () {