Skip to content

Instantly share code, notes, and snippets.

View ZeroPivot's full-sized avatar
💭
Working on Managed Partitioned Array for DragonRuby

ArityWolf ZeroPivot

💭
Working on Managed Partitioned Array for DragonRuby
View GitHub Profile
# Common configuration.
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: true
RubyInterpreters:
- ruby
- macruby
- rake
# Partitioned Arrays
**WIP.** - ***Last updated: 3/31/2022**
A partitioned array data structure which works with JSON for disk storage, and a pure JSON parser is in progress. With two constants, the algorithm creates a data structure and allocates empty associative array elements and understands the structure of the partitions.
The main purpose was I needed a way to divide an array into subelements, so that in gamedev I can flip on and off portions of the array in question to save on memory.
The data structure overall is an `Array-Of-Hashes`.
# rubocop:disable Style/FrozenStringLiteralComment
# rubocop:disable Style/IfUnlessModifier
# rubocop:disable Layout/LineLength
# Ranged binary search, for use in CGMFS
# array_id = relative_id - db_num * (partition_rate + 1)
# When checking and adding, see if the index searched for in question
PARTITION_RATE = 10
OFFSET = 1
# Common configuration.
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: true
RubyInterpreters:
- ruby
- macruby
- rake
@ZeroPivot
ZeroPivot / .rubocop.yml
Last active September 30, 2021 17:53 — forked from dsandstrom/.rubocop.yml
Rubocop config files for Ruby 3.0 / Rails 6+
# .rubocop.yml
# rubocop config files for Ruby 3.0 / Rails 6+ project
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: true
Include:
# A Study of "Value Objects" in Ruby 3.0 with RBS for static typing
#
# Ruby Code by ZeroPivot
#
# Studied from JavaScript article @ plainenglish.io (by Nayab Siddiqui);
# * URL: https://javascript.plainenglish.io/why-you-should-stop-representing-age-as-a-number-in-your-code-ea1026a86bc8
# A Value Object Class named Age
# Returns a new Age object on the addition of time (y/m/d)
# Instance objects are treated in an immutable fashion
# rubocop:disable Style/StringLiterals
# rubocop:disable Style/FrozenStringLiteralComment
# rubocop:disable Lint/RedundantCopDisableDirective
# rubocop:disable Layout/TrailingEmptyLines
# rubocop:disable Lint/RedundantCopDisableDirective
# rubocop:disable Layout/EmptyLines
require 'json'
require_relative 'aoh'
# Converts some string to JSON format, mostly for usage in the DragonRuby toolkit
@ZeroPivot
ZeroPivot / sinatra_cheatsheet.md
Created January 24, 2021 19:17 — forked from taktran/sinatra_cheatsheet.md
Sinatra cheatsheet

Useful commands

last_response
    .body

last_request
    .path
    .url
    .session

.cookies

@ZeroPivot
ZeroPivot / nginx.conf
Last active January 3, 2021 12:21
Configuration for use with Puma and Nginx
user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
#multi_accept on;
}
def sprite_fetch_arr(args, sprite_name)
sprite_coordinates = []
args.outputs.sprites.each_with_index do |sprite, index|
if (sprite.sprite_name == sprite_name)
sprite_coordinates = args.outputs.sprites[index].xywh_arr
args.outputs.labels << LabelUse.new(600, 600, "#{sprite_coordinates}", 2, 0, "fonts/AritySpeak.tif", 0, 0, 255, 255)
break
end
end