Skip to content

Instantly share code, notes, and snippets.

View kfischer-okarin's full-sized avatar

Kevin Fischer kfischer-okarin

View GitHub Profile
@kfischer-okarin
kfischer-okarin / render_area_tests.rb
Created July 15, 2024 00:37
Test Suite for Render Area
describe RenderArea do
define_helper :build_render_area do |args|
# Size of DR default render area (1280x720)
# This area is centered inside the allscreen area
args.grid.w ||= 1280
args.grid.h ||= 720
# logical pixel size of the whole screen (i.e. size of the render canvas in DR)
args.grid.allscreen_w ||= args.grid.w
args.grid.allscreen_h ||= args.grid.h
# actual pixel size of the whole screen
@kfischer-okarin
kfischer-okarin / 15_puzzle_lorempicsum.rb
Last active April 1, 2023 07:18
15 puzzle with random picture from lorempicsum
def tick(args)
args.state.grid ||= initial_grid
unless args.state.game_setup_complete
setup_game(args)
return
end
args.outputs.background_color = [0, 0, 0]
tiles = build_tiles(args.state.grid)
@kfischer-okarin
kfischer-okarin / 15_puzzle.rb
Last active April 1, 2023 06:48
15-puzzle in DragonRuby
def tick(args)
args.state.grid ||= initial_grid
setup_game(args) unless args.state.game_setup_complete
tiles = build_tiles(args.state.grid)
tiles.each do |tile|
handle_animation(args, tile)
color = COLORS[tile[:number] - 1]
@kfischer-okarin
kfischer-okarin / init.el
Last active November 15, 2021 09:54
My Emacs Configuration
(defvar init-file-location "~/.emacs.d/init.el")
(defun find-init-file ()
(interactive)
(find-file init-file-location))
(defun reload-init-file ()
(interactive)
(load-file init-file-location))
@kfischer-okarin
kfischer-okarin / performance_test.rb
Last active August 4, 2021 04:19
DR: Performance test array splat/instance var access
class MyTile
def initialize(x, y, r, g, b)
@x = x * 16
@y = y * 16
@w = 16
@h = 16
@path = 'tile'
@a = 255
@r = r
@g = g