Skip to content

Instantly share code, notes, and snippets.

View KonnorRogers's full-sized avatar

Konnor Rogers KonnorRogers

View GitHub Profile
@KonnorRogers
KonnorRogers / dialog.html
Created October 10, 2025 22:42
full screen dialog
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<script data-fa-kit-code="38c11e3f20" type="module" src="https://early.webawesome.com/[email protected]/dist/webawesome.loader.js"></script>
<link rel="stylesheet" href="https://early.webawesome.com/[email protected]/dist/styles/webawesome.css">
@KonnorRogers
KonnorRogers / draggable-sucks.html
Last active October 10, 2025 20:46
draggable...fun times.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<script data-fa-kit-code="38c11e3f20" type="module" src="https://early.webawesome.com/[email protected]/dist/webawesome.loader.js"></script>
<link rel="stylesheet" href="https://early.webawesome.com/[email protected]/dist/styles/webawesome.css">
@KonnorRogers
KonnorRogers / popover-button.js
Created September 29, 2025 16:14
popover custom elements?
class MyButton extends HTMLElement {
constructor () {
super()
this.addEventListener("click", handleClick)
}
handleClick = (e) => {
const popover = this.getAttribute("popover")
const popoverEl = this.rootNode().querySelector(`#${popover}`)
if (popver && popoverEl) {
@KonnorRogers
KonnorRogers / main.rb
Created September 20, 2025 21:28
Trying to get DR SSE working
def tick args
args.state.clients ||= {}
# by default the embedded webserver is disabled in a production build
# to enable the http server in a production build you need to:
# - update metadata/cvars.txt
# - manually start the server up with enable_in_prod set to true:
args.state.port = 3000
GTK.start_server! port: args.state.port, enable_in_prod: true
# args.outputs.background_color = [0, 0, 0]
args.outputs.labels << { x: 640,
@KonnorRogers
KonnorRogers / dungeon.rb
Created September 14, 2025 01:14
shadowcasting
module Dungeon
# Multipliers for transforming coordinates into other octants
MULT = [
[1, 0, 0, -1, -1, 0, 0, 1],
[0, 1, -1, 0, 0, -1, 1, 0],
[0, 1, 1, 0, 0, -1, -1, 0],
[1, 0, 0, 1, -1, 0, 0, -1],
]
# Determines which co-ordinates on a 2D grid are visible
@KonnorRogers
KonnorRogers / main.rb
Created September 6, 2025 08:36
Classes, Hashes, Structs, oh my.
def boot(args)
args.state = {}
end
SpriteStruct = Struct.new(:x, :y, :w, :h, :path)
class SpriteClass
attr_accessor :x, :y, :w, :h, :path
def initialize(x:, y:, w:, h:, path:)
@x = x
@KonnorRogers
KonnorRogers / index.html
Created August 22, 2025 05:30
WA Layout Stuff
<!doctype html>
<html lang="en" class=""><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web Awesome Page Demo 1</title>
<link rel="preconnect" href="https://early.webawesome.com">
<link rel="stylesheet" href="https://early.webawesome.com/[email protected]/dist/styles/themes/default.css">
<link rel="stylesheet" href="https://early.webawesome.com/[email protected]/dist/styles/webawesome.css">
<script type="module" src="https://early.webawesome.com/[email protected]/dist/webawesome.loader.js"></script>
</head>
@KonnorRogers
KonnorRogers / signals.html
Created August 6, 2025 21:41
Lite Signals
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Signals</title>
</head>
<body>
<button id="decrement">
-
@KonnorRogers
KonnorRogers / html5-loader.js
Last active August 1, 2025 03:25
Stub to add to DragonRuby for unlocking audio
// end of dragonruby-html5-loader.js ...
// .dragonruby/stubs/html5/dragonruby-html5-loader.js
const audioContext = new AudioContext()
let hasPlayed = false
function startAudioContext(context){
// this accomplishes the iOS specific requirement
var buffer = context.createBuffer(1, 1, context.sampleRate)
@KonnorRogers
KonnorRogers / dr.rb
Last active August 1, 2025 04:31
Label wrapping
# Sample from:
# https://docs.dragonruby.org/#/samples/rendering-basics?id=labels-text-wrapping-mainrb
def tick(args)
lines = ["line1", "line2", "line3", "line4"]
labels = lines.map.with_index do |text, index|
{
x: 1280 / 2,
y: 720 / 2,
text: text,
anchor_y: index