Skip to content

Instantly share code, notes, and snippets.

View rgchris's full-sized avatar

Christopher Ross-Gill rgchris

View GitHub Profile
@rgchris
rgchris / notes.md
Last active April 9, 2026 19:31
Notes on using Rebol 3 for Rebol 2 authors

This is a non-exhaustive list of some of things I've encountered in the past year of switching:

  • Contexts: Rebol 2 had three types of word spaces—SYSTEM/WORDS, OBJECT! and FUNCTION!. Rebol 3 tries to separate this out a bit with a runtime library (LIB) that contains all the 'standard' functions, SYSTEM/CONTEXTS/USER which is where all the regular script words go and imports meanings from LIB as it encounters new words, and MODULES that are kind of like extended objects designed to keep reusable code segments separate. (I've proposed and am working on some changes as to how that works with external scripts)

  • 64-bit integers expand the range of Rebol integers, though does cause a few inconsistencies with bit-shifting (can be a gotcha with some binary formats)

  • STRING! types now use multi-byte codepoints—in Oldes' Rebol 3 they are now UTF-8. W

@rgchris
rgchris / meshes.reb
Created April 4, 2026 03:32
Mesh Gradients Generator
Rebol [
Title: "Mesh Gradients"
Author: "Christopher Ross-Gill"
Date: 26-Mar-2026
Version: 0.1.0
File: %meshes.reb
Type: module
Name: rgchris.meshes
Exports: [
@rgchris
rgchris / filters.md
Last active April 3, 2026 19:44
SVG Filters

SVG Filters

These examples showcase how to incorporate filters into my SVG creation DSL. Of interest is how language is used to represent the filter pipeline.

MDN describes Filters as akin to layers that stack one on top of the other. I'd suggest it's more like a series of operations that, starting with the target element, take the result of the preceding operation and apply a filter to it. The result of the final operation replaces the target element's initial appearance in the final composition.

Basic Usage

Within the SVG dialect, a filter pipeline is created using the FILTER function. It takes three arguments: an ID (issue!), a margin (pair! or none!), and the sequence of operations (block!). The ID can be used to refer to the filter later on. By default, SVG filters use a margin of 20% of the element's width and height allowing a space for filters to 'bleed'

@rgchris
rgchris / animated.reb
Last active April 1, 2026 14:59
SVG (animated) example
Rebol [
Title: "SVG Sample"
Needs: [
r3:rgchris:svg
]
]
print svg/encode svg/create 400x400 [
rectangle #[fill: #myGradient] 20x200 360x180
circle #[fill: none stroke: #myGradient stroke-width: 10] 160x200 100
@rgchris
rgchris / README.md
Last active March 26, 2026 13:15
Whale (Animated SVG Example)

I came across this article, How Designers Should Think About SVG, and was taken by the little whale icon about a third of the way down showcasing the benefits of using SVG for animation. I noticed on clicking through to the CodePen editor that the animation portions were done in CSS. I was curious a) whether the animation could be done in pure SVG/SMIL, and b) whether my Rebol SVG module was up to the task of producing such a file in a reasonably literate fashion. Indeed the animation is doable in SMIL with some caveats, and I believe the generating code to be sufficiently clear in its intent.

Some notes:

  • It's not well documented how the additive attribute is required to make multiple transform animations work on a single el

Iterators, Part I

In this article, I will introduce iterators and discuss how they offer an intuitive interface for addressing a diverse set of programming problems. Specifically, I'll explore the potential application of iterators in Rebol, highlighting how they complement Rebol's elegant and expressive approach to problem-solving.

What are Iterators?

Iterators are mechanisms used to traverse complex data structures without exposing their internal composition. They provide a standard interface for accessing the component parts of those structures sequentially, significantly simplifying the code built around them. Iterators typically share the following characteristics:

  • Encapsulation: They encapsulate the domain logic of a given data structure, meaning you do not need to learn that structure to use it.
  • Sequential Access: Each call presents the next logical component from that domain.
@rgchris
rgchris / minimal-odt.reb
Last active February 16, 2026 19:54
Build a minimal ODT (ODF Text) in Rebol 3
Rebol [
Title: "Package a Minimal OpenText Document"
Date: 30-Dec-2021
Author: "Christopher Ross-Gill"
Rights: http://opensource.org/licenses/Apache-2.0
Home: https://gist.github.com/rgchris/e325347625b1688a1a1fe686610c68ba
Needs: [
r3:rgchris:zip
]
@rgchris
rgchris / svg.red
Last active May 22, 2025 11:52
Red SVG loader/converter
Red [
Title: "SVG Tools"
Date: 27-Jan-2020
Author: "Christopher Ross-Gill"
Rights: http://opensource.org/licenses/Apache-2.0
Version: 0.3.2
History: [
0.3.2 27-Jan-2020 "Better handling of text whitespace; bold/italic"
0.3.1 24-Jan-2020 "PATH model rewrite; VIEW wrapper to view an SVG"
0.3.0 23-Jan-2020 "Reorganise PATH handling; render whole/partial object; further refactoring"
@rgchris
rgchris / walker.md
Last active May 5, 2025 14:13
Tree iterator

Tree-Walking Iterator

This script features an iterated method of traversing a tree-structure (specifically, a tree created by the Rebol 2 mezzanine PARSE-XML). The iterator returns events—OPEN, CLOSE, EMPTY, and TEXT—upon request until the tree has been fully traversed.

Concept Note

Using an iterated approach to tree traversal allows for fine control of the process that can be dropped and picked up fairly intuitively, effectively reducing the traversal process to a linear stream of events useful for serialization or extraction. This stands in contrast to the callback approach that fully traverses a tree firing callback functions until the tree has been fully traversed.

@rgchris
rgchris / dsl-example.r2
Created January 29, 2023 19:01
DSL Example
Rebol [
Title: "DSL Example"
Author: "Christopher Ross-Gill"
Date: 29-Jan-2023
Home: https://gist.github.com/rgchris/2a227b6fa3fc9d2ae7fe729ccb09f016
]
reduce-only: func [
"Evaluates a block of expressions excepting SET-WORD! values"