Skip to content

Instantly share code, notes, and snippets.

@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,
@skinnyjames
skinnyjames / cursed.rb
Last active December 26, 2024 15:22
cursed
# dependencies
require_relative "../src/hokusai"
require_relative "../src/hokusai/backends/sdl2"
require_relative "../src/hokusai/backends/raylib"
module Dynamic
class Block < Hokusai::Block
template <<~EOF
[template]
empty
# frozen_string_literal: true
# dependencies
require_relative "../src/hokusai"
require_relative "../src/hokusai/backends/sdl2"
require_relative "../src/hokusai/backends/raylib"
require_relative "./stock"
require_relative "./tic_tac_toe"
# can use ruby stdlib
@skinnyjames
skinnyjames / test_cli.cr
Last active March 12, 2024 15:37
test.cr
require "socket"
require "./format"
module Test
Log.setup do |log|
dispatcher = Log::DispatchMode::Direct
backend = Log::IOBackend.new(dispatcher: dispatcher, formatter: Format)
log.bind "*", :trace, backend
end
@skinnyjames
skinnyjames / test.md
Created February 28, 2024 17:55
idea

The premise for the layouting is using sane defaults. Ignoring the propositions of css and html for a while, imagine a whitespace significant template.

{{ template }}
root
  hblock
    text {:content="first"}
    vblock
      text {:content="second"}
 text {:content="third"}
@skinnyjames
skinnyjames / generator.rb
Created May 9, 2023 14:57
start of winole.cr
require "json"
ole = JSON.parse(File.read("./ole.json"))
def payload_to_pointers(payload, str = "")
if payload["Kind"] == "PointerTo"
str << "*"
return payload_to_pointers(payload["Child"], str)
elsif payload["Kind"] == "ApiRef"
@skinnyjames
skinnyjames / server.rb
Created February 15, 2022 16:13
server
require "sinatra/base"
require "json"
module Stuff
class App < Sinatra::Base
s = Mutex.new
@@last_address = nil
@@first_address = nil
@skinnyjames
skinnyjames / chat.cr
Last active February 15, 2022 16:03
chat
require "socket"
module Chat
def self.init(url : String, port : Int32 = 80)
tcp = TCPSocket.new
tcp.reuse_address = true
tcp.reuse_port = true
tcp.connect url, port
tcp << "GET /connect HTTP/1.1\r\nHost: #{url}\r\nUser-Agent: curl/1.0\r\nConnection: Keep-Alive\r\nAccept: */*\r\nContent-Length: 0\r\n\r\n"
me = tcp.local_address.address
module Boxy
def self.create
end
def self.remove(container : AbstractContainer)
end
def self.containers : Array(AbstractContainer)
end