Skip to content

Instantly share code, notes, and snippets.

View greggirwin's full-sized avatar

Gregg Irwin greggirwin

  • Redlake Technologies
View GitHub Profile
@DideC
DideC / Livecode enhanced
Last active February 20, 2018 19:32
Based on Dockimbel VID livecode, this is a little more advanced version where you can define Red's values used by the VID code. The window is resizable and there is spliters to rearange space.
Red [
Title: "Simple GUI livecoding demo"
Author: "Nenad Rakocevic / Didier Cadieu"
File: %livecode.red
Version: 1.2.1
Needs: 'View
Usage: {
Type VID code in the bottom right area, you will see the resulting GUI components
rendered live on the left side and fully functional (events/actors/reactors working live).
The top right area let you define Red's values to be used in your VID code, even functions or anything.
@dockimbel
dockimbel / to-Roman.red
Last active October 12, 2016 20:16
Arabic to Roman numbers converter in Red
Red [
Purpose: "Arabic to Roman numbers converter"
Date: "06-Oct-2016"
]
table: [1000 M 900 CM 500 D 400 CD 100 C 90 XC 50 L 40 XL 10 X 9 IX 5 V 4 IV 1 I]
to-Roman: function [n [integer!]] reduce [
'case collect [
foreach [a r] table [
@DideC
DideC / roman-to-from-arabic.red
Last active October 7, 2016 09:00
Conversion between Arabic and Roman numbers in Red
Red [
Purpose: "Arabic <-> Roman numbers converter"
Author: "Didier Cadieu"
Date: "07-Oct-2016"
]
; Lookup tables for conversion
table-r2a: reverse copy table-a2r: [1000 "M" 900 "CM" 500 "D" 400 "CD" 100 "C" 90 "XC" 50 "L" 40 "XL" 10 "X" 9 "IX" 5 "V" 4 "IV" 1 "I"]
roman-to-arabic: func [r [string!] /local a b e] [
@DideC
DideC / focus.red
Created October 19, 2016 08:37
Tiny VID utility func and test (find-window, focus)
Red [
title: "Test of `find-window and `focus funcs"
author: "Didier Cadieu"
]
find-window: func [
"Find a face's window face."
face [object!]
][
while [face/parent] [face: face/parent]
@maximvl
maximvl / restarts.red
Last active August 14, 2019 12:30
CL condition-restarts in Red
Red [
author: "Maxim Velesyuk"
description: "Common Lisp condition-restart system implementation for Red"
]
; utils
*word-counter*: 0
gen-word: does [
*word-counter*: *word-counter* + 1
to-word append "G-" to-string *word-counter*
@maximvl
maximvl / poor-mans-scopes.red
Last active August 14, 2019 12:30
Dynamic variables in Red
Red [
author: "Maxim Velesyuk"
description: "Dynamic variables implementation for Red"
]
; utils
forskip: func ['series skipn body /local s] [
s: get series
while [ not tail? s ] [
do body
@toomasv
toomasv / fill.red
Last active August 29, 2017 16:39
Formatting a value
Red [
Author: "Gregg Irwin"
File: "%fill.red"
Source: "Gitter @greggirwin "
Reference: ":point_up: [May 4, 2017 6:50 PM](https://gitter.im/red/red/welcome?at=590b4daac93941e153c94b8e)"
Changed-by: "Toomas Vooglaid"
Changed-date: "2017-05-05"
Change: "Added 'justify and helper 'x'"
]
x: make op! func [n c][pad/with copy "" n to char! c]
@toomasv
toomasv / dir-tree.red
Last active January 6, 2022 11:30
Print a directory tree
Red [
Author: "Toomas Vooglaid"
Date: "2017-05-07"
Changed: "2018-07-09"
Purpose: "Print a directory tree"
File: "%dir-tree.red"
]
context [
; Some helpers
get-char: func [hex][to-char to-integer hex]
@x8x
x8x / code.red
Last active December 30, 2017 10:11
Improved ls and some utilities functions (TESTED on Linux and macOS only)
Red []
#if config/OS <> 'Windows [
colors: [black red green yellow blue magenta cyan white]
;https://en.wikipedia.org/wiki/ANSI_escape_code
color: function [s f /bg b /space][
o: clear {}
s: form s
if space [s: rejoin [{ } s { }]]
Red [
Needs: 'View
]
; #include %support/call.red
print "clr - define object"
celer: object [