Instantly share code, notes, and snippets.

Toomas Vooglaid toomasv

View GitHub Profile
Red [
Author: "Toomas Vooglaid"
Date: 13-Feb-2019
Purpose: {Example of dragging words from area to text-list}
count-nl: func [face /local text n x][
n: 0 x: face/selected/x
text: copy face/text
while [all [
text: find/tail text #"^/"
View syntax.rtd
Red [
Author: "Toomas Vooglaid"
Date: 2019-01-14
Purpose: {Study of syntax highlighting}
skp: charset " ^/^-[]()/"
initial-size: 800x800
addr: func [s1 s2 style] bind [keep as-pair i: index? s1 (index? s2) - i keep style] :collect
rule: [any [s:
Red [
Purpose: "Longest Common Subsequence"
Date: 8-Jan-2019
Last: 10-Jan-2019
lcs: function [s t][
case [ ; preliminary checks
s = t [return copy s]
any [empty? s empty? t] [return copy ""]
Red [
Date: 6-Jan-2019
lev: function [s t][
unless string? s [s: mold s]
unless string? t [t: mold t]
case [
s = t [return 0]
empty? s [return (length? t)]
Red []
ctx: context [
char: charset {([{}])"} ;"
opens: charset "[("
closes: charset "])"
line: 1
stack: make block! 1000
mark: comm: none
instr: false
inmulti: 0
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]]
Red [
Author: "Toomas Vooglaid"
Date: 2018-12-09
Purpose: {Study of freehand drawing on area}
do load-thru ; make-transparent
img: draw 200x200 [box 0x0 199x199]
img: make-transparent img 255
style: 'thin
view [
Red [
Title: "Explosions in Red"
Date: 14-Nov-2018
Author: "Bohdan Lechnowsky"
Adaptation: "Toomas Vooglaid"
Notes: {
Derived from "Explosions in Python" from p.33 of "Wireframe" magazine ( Issue 1.
Unlike the above program that requires Python to be installed, plus "Pygame Zero" (whatever
Red [
Author: "Toomas Vooglaid"
Date: 12-Nov-2018
Purpose: {Alternative math func with left-associative power op!s}
*r: make op! func [a b][a ** (1.0 / b)]
math2: function [
{Math with more-or-less correct operations ordering,
left-associative power-ops included}
Red [
Author: {Toomas Vooglaid}
Date: 2018-11-07
Purpose: {Study of stick}
pos: joint: bone: len: none
sel: "Move:"
mode: "Mode-1"
movs: make block! 20