Skip to content

Instantly share code, notes, and snippets.

View dockimbel's full-sized avatar

Nenad Rakocevic dockimbel

View GitHub Profile
@greggirwin
greggirwin / fill-pen-lab.red
Created June 18, 2016 02:55
Fill-pen Lab for Red
Red [
Title: "Fill-pen Lab"
Author: "Gregg Irwin"
File: %fill-pen-lab.red
Needs: View
]
to-color: function [r g b][
color: 0.0.0
if r [color/1: to integer! 256 * r]
@greggirwin
greggirwin / resize-image.red
Created June 19, 2016 19:30
Red interactive image resizing demo
Red [
Title: "Draw Image Resizing Test"
Author: [REBOL version "Carl Sassenrath" Red port "Gregg Irwin"]
Version: 0.0.1
Needs: View
]
distance: func [pos [pair!]][square-root add pos/x ** 2 pos/y ** 2]
grab-size: 5
@greggirwin
greggirwin / view-hanoi.red
Last active December 14, 2016 05:51
Graphical Red Towers of Hanoi
Red [
File: %view-hanoi.red
Author: "Gregg Irwin"
Date: "4-Oct-2001 — 26-Jun-2016"
Needs: View
]
num-disks: 5 ; Have to set this here until it gets into the UI.
disk-height: 15
disk-cell-width: 20 ; Smallest disk is 1 cell wide
@greggirwin
greggirwin / vector-balls.red
Last active July 8, 2016 09:29
Red Vector Balls
Red [
Title: "Vector Balls Demo"
Author: ["Nenad Rakocevic" "Gregg Irwin"]
Date: "[2-feb-2001 15-jun-2016]"
File: %vector-balls.red
Version: 0.4
History: {[
0.2 12-jun-2000 "First version released."
0.3 02-feb-2001 "Speed field added"
0.4 26-jun-2016 "Ported to Red by Gregg"
REBOL []
src: read %lizard.svg
transparent: 0.0.0.255
;** Stack operations
pile: tail reduce [copy [pen transparent]] ;** by default, no pen color
rollback: does [pile: back pile]
@greggirwin
greggirwin / vid-pico-sheet.red
Last active August 19, 2017 15:13
VID version of Nenad's Native Red PicoSheet
Red [
Title: "Tiny VID Spreadsheet"
Author: ["Gregg Irwin" "based on Nenad's Native PicoSheet"]
Needs: View
]
sheet-size: 8x8
cell-size: 100x24
L: charset "ABCDEFGHIabcdefghi"
@greggirwin
greggirwin / arity-of.red
Last active April 12, 2021 17:47
Red arity-of function
; We have other reflective functions (words-of, body-of, etc.), but
; this is a little higher level, sounded fun to do, and may prove
; useful as we write more Red tools. It also shows how to make your
; own typesets and use them when parsing.
arity-of: function [
"Returns the fixed-part arity of a function spec"
spec [any-function! block!]
/with refs [refinement! block!] "Count one or more refinements, and add their arity"
][
@greggirwin
greggirwin / greggs-mezz.red
Last active June 21, 2018 18:54
A bunch of general purpose mezzanine funcs for Red.
Red [
File: %greggs-mezz.red
Author: "Gregg Irwin"
Purpose: "An interim mezzanine dump, while Red is still moving fast."
Tabs: 4
Comment: {
Not everything here has been well-tested or, well, tested. Most
of the functions are ports from R2, with many more to come. I'm
combining everything in one file for ease of experimentation, so
you don't have to worry about includes or dependencies with the
@greggirwin
greggirwin / trig-lab.red
Last active October 23, 2017 19:53
Interactive trig function laboratory
Red [
Title: "trig-lab.red"
Author: "Gregg Irwin"
File: %trig-lab.red
Needs: 'View
Purpose: {
See %math-lab comments for details. This script focuses
on trigonometric functions.
}
]
@maximvl
maximvl / lc.r
Last active December 14, 2016 05:54
List comprehension dialect for Rebol
REBOL []
print []
lc: function [block] [lc-state lc-rule input-rule filter-rule i e] [
lc-state: make object! [
do-block: copy []
inputs: copy []
filter-block: none
input-state: copy []
res: copy []
]