Skip to content

Instantly share code, notes, and snippets.

@skinnyjames
skinnyjames / panel.rb
Created June 3, 2026 09:57
friction.rb
module HackOS
class Panel < Hokusai::Block
template <<~EOF
[template]
clipped {
@tap="on_tapdown"
@drag="on_taphold"
@taphold="on_taphold"
@swipe="on_swipe"
@taprelease="on_taprelease"
@skinnyjames
skinnyjames / launcher.rb
Created June 1, 2026 14:14
launcher code
module HackOS
class MovingIcon < Hokusai::Block
template <<~EOF
[template]
virtual
EOF
computed! :moving
computed! :name
computed! :width
class ACamera < Hokusai::Block
template <<~EOF
[template]
empty { @click="add_filter" }
EOF
uses(empty: Hokusai::Blocks::Empty)
attr_accessor :lw, :lh, :texture, :camera
@skinnyjames
skinnyjames / character-mover.rb
Created April 8, 2026 22:13
Just the code to slice a sprite sheet up and move the character. It needs the spritesheet to work, I'll publish a repo if you want to try it out.
class Char < Hokusai::Block
template do
child(Hokusai::Blocks::Empty) do
on(:keydown) do |event|
move(event)
end
end
end
# 68x68 blocks
@skinnyjames
skinnyjames / composed.gemspec.rb
Last active November 1, 2025 05:35
MRBuild gemspecs
gemspec("counter-app") do |config|
gem path: "../mruby"
gem path: "../hokusai-pocket"
end
@skinnyjames
skinnyjames / gemspec.rb
Last active October 28, 2025 06:40
proposal gemspec api from mruby
# Proposed DSL API
# Declare a gemspec with an ID
#
# conf contains properties about the build
gemspec "mruby-hokusai-pocket" do |conf|
conf.version = "0.1.0"
conf.author = "skinnyjames"
#..etc
@skinnyjames
skinnyjames / README.md
Last active July 27, 2025 17:25
Squares w/ Hokusai
@skinnyjames
skinnyjames / idea.md
Last active June 18, 2025 06:41
idea

The strategy is about representing the initial state of a file, adding patches (which add changes to a file), and the reconstruction of a file from a given patch's ancestor tree is about calculating offsets.

A rough schema looks like...

 // the initial file
    CREATE TABLE IF NOT EXISTS files (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      directory INTEGER CHECK( directory in (0, 1) ) NOT NULL DEFAULT 0,
      content BLOB DEFAULT NULL,
      added_on INTEGER NOT NULL,
@skinnyjames
skinnyjames / idea.md
Last active June 14, 2025 23:39
vcs idea

The strategy is about representing the initial state of a file, adding patches (which add changes to a file), and the reconstruction of a file from a given patch's ancestor tree is about calculating offsets.

A rough schema looks like...

    // the initial file
    CREATE TABLE IF NOT EXISTS files (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      directory INTEGER CHECK( directory in (0, 1) ) NOT NULL DEFAULT 0,
      content BLOB DEFAULT NULL,
      added_on INTEGER NOT NULL,