Skip to content

Instantly share code, notes, and snippets.

View rgchris's full-sized avatar

Christopher Ross-Gill rgchris

View GitHub Profile
Rebol [
Title: "Ascii 85 Encoder/Decoder for Rebol 2"
Date: 6-Jan-2021
Author: "Christopher Ross-Gill"
Version: 1.0.0
]
pow-85: [52200625 614125 7225 85 1]
ascii85: charset [#"!" - #"u"]
whitespace: charset as-string #{00090A0C0D20}
@rgchris
rgchris / form-decimal.r
Last active January 5, 2021 01:51
Form Decimal
Rebol [
Title: "Form Decimal for Rebol 2"
Date: 4-Jan-2021
Author: "Christopher Ross-Gill"
Purpose: "Render a decimal! value sans scientific notation"
Tests: [
"12345000000000000000000"
"0.0000000000001"
"0.1"
"-0.1"
@rgchris
rgchris / clean-path.reb
Last active December 20, 2020 18:02
Updated Clean-Path function for Ren-C
Rebol [
Title: "Modified Clean-Path function"
Date: 20-Dec-2020
Author: "Christopher Ross-Gill"
]
clean-path: func [
{Returns new directory path with `.` and `..` processed.}
path [file! url! text!]
/only "Do not prepend current directory"
@rgchris
rgchris / storage-scheme.reb
Created December 19, 2020 03:55
HTML5 Storage Scheme for Ren-C (In-Browser)
Rebol [
Title: "Storage Scheme"
Date: 18-Dec-2020
Author: "Christopher Ross-Gill"
]
make object! [
storage-enabled?: js-native [] {
return reb.Logic(
typeof Storage !== 'undefined'
@rgchris
rgchris / sql-lexer.bnf
Last active December 6, 2020 19:41
SQL Lexer
Statement ::= (Newline | Whitespace | '(' | ')' | ',' | '.' | Value | ';')*
Value ::= Comment-Line | Comment | String-Single | String-Double | Literal | Variable | Word | Number | Misc
Comment-Line ::= ('--' | '#') [^#xA#xD]*
Comment ::= '/*' ( [^*] | '*'+ [^*/] )* '*'* '*/'
String-Single ::= "'" ([^'\]+ | '\\' | "\'" | "''")* "'"
@rgchris
rgchris / png-pixel.reb
Created December 4, 2020 20:17
Single Pixel in Ren-C (R3C)
Rebol [
Title: "Single Pixel PNG"
Date: 4-Dec-2020
Author: "Christopher Ross-Gill"
]
chunkify: func [
header [word!]
data [binary!]
/compress
@rgchris
rgchris / octals.r
Last active June 17, 2020 17:10
Counting Octal Numbers
Rebol [
Title: "Octal Notation"
Date: 16-Jun-2020
Author: "Christopher Ross-Gill"
Notes: https://www.jstor.org/stable/983079?seq=35#metadata_info_tab_contents
]
octal-tables: collect [
foreach suffix [
"" "ty" "der" "tyder" "sen" "tysen" "dersen" "tydersen" "kaly"
@rgchris
rgchris / clean-script.r
Last active May 22, 2020 19:38
Clean Script for Rebol 2
Rebol [
Title: "Rebol Script Cleaner (Pretty Printer)"
Date: 5-Jan-2020
File: %clean-script.r
Author: "Christopher Ross-Gill"
Purpose: {
Cleans (pretty prints) Rebol scripts by parsing the Rebol code
and supplying standard indentation and spacing.
}
History: [
Red [
Title: "Walk through a VID tree (non-recursive)"
Author: "Christopher Ross-Gill"
Date: 18-Aug-2019
Comment: "Goes backwards - most prominent faces first"
]
Rebol [
Comment: "Works in Rebol 2 as well"
]
@rgchris
rgchris / rebol.svg
Last active July 3, 2019 07:01
Rebol (and family) logos as a small set of SVG shapes.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.