Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Ross-Gill rgchris

View GitHub Profile
@rgchris
rgchris / istype.js
Last active Apr 2, 2021
A type-checking function in JavaScript
View istype.js
window.istype = function(value, explicit = false) {
let type = Object.prototype.toString.apply(value).match(
/\[object ([A-Za-z_0-9]+)\]/
)[1]
switch (type) {
case "Boolean":
case "String":
case "BigInt":
case "Undefined":
@rgchris
rgchris / state-machine.reb
Last active Feb 15, 2021
State Machine for Ren-C (R3C)
View state-machine.reb
Rebol [
Title: "State Machine Dialect"
Date: 3-Feb-2021
Author: "Gabriele Santilli"
File: %state-machine.reb
Type: module
Name: rgchris.state-machine
Version: 1.8.1
Exports: [state-machine]
@rgchris
rgchris / data-uri.reb
Last active Feb 13, 2021
Scheme for Encoding/Decoding Data URIs
View data-uri.reb
Rebol [
Title: "Data URI Scheme"
Date: 13-Feb-2021
Author: "Christopher Ross-Gill"
]
use [chars type] [
chars: complement charset "^-^/^M ,/;"
sys/make-scheme [
@rgchris
rgchris / textmate.reb
Last active Feb 8, 2021
TextMate Bundle Support File (R3C)
View textmate.reb
Rebol [
Title: "TextMate Support"
Author: "Christopher Ross-Gill"
Date: 8-Feb-2021
Type: module
Name: rgchris.textmate
Exports: [tm textmate neaten envelop form-error]
]
tm: make object! [
@rgchris
rgchris / clean-script.reb
Last active Feb 10, 2021
Clean Script for R3C
View clean-script.reb
Rebol [
Title: "Rebol Script Cleaner (Pretty Printer)"
Date: 10-Feb-2021
File: %clean-script.reb
Version: 1.2.3
Type: module
Name: rgchris.clean-script
Exports: [clean-script]
Author: "Christopher Ross-Gill"
Purpose: {
@rgchris
rgchris / presentation.r
Last active Feb 2, 2021
Presentation Style for Rebol/View 2
View presentation.r
Rebol [
Title: "Presentation Style"
Author: "Christopher Ross-Gill"
Date: 20-Sep-2004
History: {
Based on "Presentation Dialect" by Jeff Kreis
15-Jan-2001
https://www.cs.unm.edu/~whip/make-presentation.r
https://www.cs.unm.edu/~whip/test-prez.r
@rgchris
rgchris / lzw.reb
Created Feb 1, 2021
LZW (De)Compression for R3C
View lzw.reb
Rebol [
Title: "LZW (De)Compression Routine"
File: %lzw.reb
Author: "Christopher Ross-Gill"
Date: 31-Jan-2021
Version: 0.1.0
Type: module
Name: rgchris.lzw
Exports: [lzw]
Needs: [%bitwise.reb] ; https://gist.github.com/rgchris/aeaf8b7467906844d4275e8b9af09397
@rgchris
rgchris / bitwise.reb
Created Jan 28, 2021
Bitwise Helpers for R3C
View bitwise.reb
Rebol [
Title: "Bitwise Helpers"
Date: 28-Jan-2021
Author: "Christopher Ross-Gill"
Type: module
Name: rgchris.bitwise
Exports: [shift-binary signed32]
Notes: {
* General Purpose BINARY SHIFT function (not optimized)
* Signed-32 helpers
@rgchris
rgchris / parser.reb
Last active Jan 26, 2021
Parse Machine for R3C
View parser.reb
Rebol [
Title: "Parse Machine"
Author: "Christopher Ross-Gill"
Date: 24-Jan-2021
Home: https://github.com/rgchris/Scripts
File: %parser.reb
Version: 0.2.2
Purpose: {
Provides a versatile wrapper around PARSE for handling diverse
data formats.
View ascii85.r
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}