Skip to content

Instantly share code, notes, and snippets.

View rgchris's full-sized avatar

Christopher Ross-Gill rgchris

View GitHub Profile
@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 / 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: [
@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"
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 / make-scorecard.r
Last active July 1, 2019 17:09
Softball Scorecard Generator
#!/usr/local/bin/rebol -qs
Rebol [
Title: "Generate a Softball Scorecard"
Date: 30-Jun-2019
Author: "Christopher Ross-Gill"
Target: %Softball%20Scorecard.pdf
Home: https://gist.github.com/rgchris/77e4c6482e4cdf0465603aaf825f7d66
Notes: {
This was needed for some back-pocket scoring for an
@rgchris
rgchris / rebol.svg
Last active July 3, 2019 07:01
Rebol (and family) logos as a small set of SVG shapes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgchris
rgchris / rebolsays.html
Created June 1, 2019 11:42
Rebol Says...
<!DOCTYPE html>
<html>
<head>
<title>Rebol says Hello</title>
<link rel="shortcut icon" href="http://rebol.info/assets/rebolbot.png">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<!-- %load-r3.js looks for all "text/rebol" <script> tags and runs them -->
<script src="https://metaeducation.s3.amazonaws.com/travis-builds/load-r3.js"></script>
</head>
@rgchris
rgchris / find-word.md
Last active April 26, 2019 20:17
Find whole words in a string

This was my response to a question Explaining Parse Rules on RebolForum wrt. matching whole words in a string.

"The input string can contain any number of delimiters, followed by the word we are searching for, and then any delimiter or else the end of the string. If we find the word, return ??? what exactly? Or, if we don't find the word, then there can be any characters or delimiters to the end. (And then what does the "end skip" do?)

I should start by saying that I don't normally use return in this way: I don't much for return at all, rather let all the branches play out to their conclusion. I used it here for expediency.

The problem here is defined as 'whole words'--we need to discern what a whole word is. In Regex, you might write /\bWordToMatch\b/ with that handy little \b shorthand which is a zero-width match between a stream of \w (word) chara

@rgchris
rgchris / minimal-epub.reb
Last active December 31, 2021 01:34
Build a minimal EPUB in R3C
#!/usr/local/bin/ren-r3c
Rebol [
Title: "Package a Minimal eBook"
Date: 5-Feb-2019
Author: "Christopher Ross-Gill"
Rights: http://opensource.org/licenses/Apache-2.0
Home: https://gist.github.com/rgchris/14e4ce92b1830f8295a1824cbe1628a7
Notes: [
https://ebooks.stackexchange.com/a/1184