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
@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

# 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
# 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
@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:
# Common configuration.
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: true
RubyInterpreters:
- ruby
- macruby
- rake
# 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
# 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`.
# Common configuration.
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: true
RubyInterpreters:
- ruby
- macruby
- rake