Skip to content

Instantly share code, notes, and snippets.

View greggirwin's full-sized avatar

Gregg Irwin greggirwin

  • Redlake Technologies
View GitHub Profile
@meijeru
meijeru / word-finder.red
Last active April 6, 2020 09:06
Word-finder: find occurrences of any word in the toolchain source files
Red [
Title: "Word finder"
Purpose: {Find occurrences of words in the source files
of the Red toolchain and display them}
Author: "Rudolf W. MEIJER"
File: %word-finder.red
Needs: 'View
Rights: "Copyright (c) 2019 Rudolf W. MEIJER"
History: [
[0.0 23-Jan-2019 {Start of project}]
@meijeru
meijeru / check-structure.red
Last active February 1, 2019 16:22
Check if brackets/parens are matching in a Red source and give errors with indication of line number
Red [
Title: "Red program structure checker"
Purpose: {Check if brackets/parens are matching in a Red file
and give errors with indication of line number}
Author: "Rudolf W. MEIJER"
File: %check-structure.red
History: [
[0.0 04-Jan-2019 {Start of project}]
[0.5 05-Jan-2019 {First working version}]
[0.6 01-Feb-2019 {Added %" "}]
@dockimbel
dockimbel / check-brackets.red
Last active January 4, 2019 20:24
PoC script for checking if brackets/parens are matching in a Red file
Red [
Purpose: "PoC script for checking if brackets/parens are matching in a Red file"
]
check-brackets: function [file [file!]][
line: 1
stack: clear []
skip-chars: complement charset "[]()^/"
parse read file [
@toomasv
toomasv / thru.red
Last active February 22, 2022 07:18
Like `range`, but op!
Red [
Author: "Toomas Vooglaid"
Date: 2018-12-11
Improvements: @9214
]
thru: make op! func [a b /local inc op cmp][
inc: pick [1% 1] percent? a
set [op cmp] reduce pick [[:+ :<][:- :>]] a < b
collect [until [keep a b cmp a: a op inc]]
]
@toomasv
toomasv / dir-tree2.red
Last active September 8, 2018 19:57
Dir-tree with string return
Red [
Author: "Toomas Vooglaid"
Date: "2017-05-07"
Changed: "2018-09-08"
Purpose: "Print a directory tree"
File: "%dir-tree.red"
]
context [
; Some helpers
get-char: func [hex][to-char to-integer hex]
@nedzadarek
nedzadarek / help-vid.red
Created September 3, 2018 12:10
Help system for vid (tested with Red for Windows version 0.6.3 built 26-Mar-2018)
Red [
author: "Nędza Darek"
license: "Just point to this repository/gist"
content-used: [
examples: http://www.red-by-example.org
docs: https://doc.red-lang.org/en/vid.html
]
bugs-new_features: [
printing: {Print in nice form and divide by words}
]
@toomasv
toomasv / multi-selection-text-list.red
Last active August 11, 2018 19:24
Multi-selection text-list
Red [
Author: "Toomas Vooglaid"
Date: 2018-08-10
Last: 2018-08-11
Purpose: {Attempt at multi-selection text-list style}
]
cnt: 0
view [
style multi-selection-text-list: text-list
on-create [face/extra: object [key: none selected: none selection: copy [] nums: copy [] layer: none]]
@toomasv
toomasv / concat.red
Last active July 20, 2019 20:03
Concatenating any-strings
Red [
Author: "Toomas Vooglaid"
Date: 2018-08-04
Last: 2019-04-19
Purpose: "Concatenating any-strings with provided delimiter"
Licence: "MIT"
]
concat: function [
arg1 [any-string! any-block!]
arg2 [series! any-word! any-path! char!]
@toomasv
toomasv / find-wild.red
Last active October 18, 2019 18:24
`find` with wildcards
Red [
Author: "Toomas Vooglaid"
Date: 2018-08-04
Last: 2018-08-04
Purpose: "Adding wildcards to `find`"
]
find': function [series 'value /part length /only /case /same /any /with wild /skip size /last /reverse /tail /match][
system/words/case [
any [
out: none
Red []
export: func [
"Export a value to the global context"
'word [set-word!]
value
/to ctx [any-word! any-object! function!]
] [
set word :value
unless :ctx [ctx: system/words]