Skip to content

Instantly share code, notes, and snippets.

View greggirwin's full-sized avatar

Gregg Irwin greggirwin

  • Redlake Technologies
View GitHub Profile
@toomasv
toomasv / regex.red
Last active November 20, 2017 18:22
Regex to parse translator
Red [
Author: "Toomas Vooglaid"
file: "%regex.red"
Purpose: {Regex to parse converter}
History: {Started: 2017-05-09
v.0.1: 2017-05-12 -- first working version with:
start `^^` and end `$` anchors,
non-capturing groups (one level) with alterns,
quantifiers (possessive),
some character-classes.
@meijeru
meijeru / arith.txt
Last active September 6, 2017 15:36
Types of artihmetic operations
Updated to Red for Windows version 0.6.2 built 7-Jun-2017/15:13:57+2:00
The table gives type of first operand, type of second operand, result type
for + (add), - (subtract), * (multiply), / (divide), // (modulo) and % (remainder)
For vectors, the element type is distinguished.
There is one case (time with time) where the result type is not the same
for all allowed operations.
After each type combination, the reverse combination is given.
The fourth column gives the operators for which the combination is forbidden.
If the result type is error, the combination is forbidden for all operators.
@rebolek
rebolek / nsource.red
Last active June 19, 2019 20:11
Provides source of Red native functions
Red [
Title: "Nsource - native source"
Purpose: "Print source for native functions"
Author: "Boleslav Březovský"
Date: "8-6-2017"
]
indent: func [
"(Un)indent text by tab"
string [string!] "Text to (un)indent"
@dockimbel
dockimbel / dyn-board.red
Last active July 8, 2017 15:52
Dynamic View usage example: drawing a board of buttons
Red [
Title: "Dynamic View usage example"
Author: "Nenad Rakocevic"
Date: 08/07/2017
]
generate: function [board [pair!] sz [pair!] return: [block!]][
pane: make block! sz/x * sz/y
pos: 1x1
count: 1
Red [
author: { Maxim Velesyuk }
description: {
colors palette showcase
}
]
sys-words: words-of system/words
colors: copy []
forall sys-words [
@luce80
luce80 / resize-image.red
Last active December 8, 2017 09:04
Draw Image Resizing Test with reaction
Red [
Title: "Draw Image Resizing Test"
Author: [REBOL version "Carl Sassenrath" Red port "Gregg Irwin" Reacting version "Marco Antoniazzi"]
Version: 0.0.2
File: %resize-image.red
Needs: View
]
img: load/as any [
attempt [read/binary img-url: https://pbs.twimg.com/profile_images/501701094032941056/R-a4YJ5K.png]
@honix
honix / let.red
Last active September 5, 2017 15:24
Red []
let: func [
binds
block
/local
ctx
][
ctx: context append/only append binds copy [result: do] block
select ctx 'result
@rebolek
rebolek / base32.red
Created August 16, 2017 20:18
Base 32 encoder and decoder
Red [
file: %base32.red
date: 17-Sep-2015
author: "Graham Chiu"
red-version: "Boleslav Březovský"
version: 0.0.3
notes: {
encodes string to base32 or base32hex
padding to 5 characters is not required in this method
>> to-base32/decode/hex to-base32/hex "yessir"
@toomasv
toomasv / reverse.red
Last active September 1, 2017 06:25
Rewrite of `reverse` to allow record-like reversing
reverse: func [
series /skip size /part length /local i tuple
][
switch type?/word series [
pair! [return to-pair reduce [series/2 series/1]]
tuple! [tuple: clear [] repeat i length? series [append tuple pick series i] series: copy tuple tuple: yes]
]
size: any [size 1]
either 0 = ((length? series) % size) [
length: any [length length? series]
Red[]
reduce+: func [
"Reduce with unset!, error! -> none! conversion"
block
/local value new-block
][
new-block: block
collect [
until [