Skip to content

Instantly share code, notes, and snippets.

View dockimbel's full-sized avatar

Nenad Rakocevic dockimbel

View GitHub Profile
turtle: #()
win: layout [ panel [
tfield: base 500x500 white draw []
origin tfield/offset tlayer: base 500x500 255.255.255.255 draw [] ]
panel [
text "History" return history: text-list 200x350 data [] return
panel [ button "Save" [save request-file history/data]
button "Load" [commands: load request-file foreach cmd commands [process-cmd cmd]] ]
return status: text "" 200x25 ]
@dockimbel
dockimbel / arity-of.red
Created April 24, 2017 02:51 — forked from greggirwin/arity-of.red
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"
][
Red [
Author: "ifgem"
]
#do [
macro: context [
make-object-spec: function [words] [
spec: copy []
@dockimbel
dockimbel / heart-animation.red
Created January 10, 2017 05:16 — forked from DideC/heart-animation.red
Heart animation for Red (only). Now with a complete control panel to play with the animations parameters. Nice time eater ;-)
Red [
title: "Heart animation"
author: "Didier Cadieu"
notes: {
Traduction in Red/Rebol of Terebus Volodymyr javascript demo : http://codepen.io/tvolodimir/pen/wqKuJ
}
Needs: View
]
;*** Settings
@dockimbel
dockimbel / haiku.red
Created December 29, 2016 14:32 — forked from maximvl/haiku.red
Red [
description: {
Attempt to copy Haiku Editor
(http://forthsalon.appspot.com/haiku-editor)
}
]
map: func [s 'word body] [
bind body 'word
forall s [
@dockimbel
dockimbel / bmr-calc.red
Created October 30, 2016 04:48 — forked from greggirwin/bmr-calc.red
Reactive BMR calculator in Red
Red [
Title: "BMR (Basal Metabolic Rate) Calculator"
Author: "Gregg Irwin"
File: %bmr-calc.red
Needs: View
Comment: {
An experiment in reactivity and data modeling.
145 lines with blanks and comments removed.
Red[
Title: "Raytracer"
Needs: 'View
Notes: "Simple raytracer based on 'Ray Tracing in One Weekend' by Peter Shirley"
]
vec3_dot: function [a[vector!] b[vector!]] [
reduce (a/1 * b/1) + (a/2 * b/2) + (a/3 * b/3)
]
Red [
Title: "Conway's Game of Life"
Needs: 'View
]
grid: collect [repeat i 10 [keep/only collect [repeat j 10 [keep random true]]]]
scratchgrid: collect [repeat i 10 [keep/only collect [repeat j 10 [keep false]]]]
a: copy grid/1
b: copy grid/10
@dockimbel
dockimbel / Livecode enhanced
Created September 10, 2016 06:05 — forked from DideC/Livecode enhanced
Based on Dockimbel VID livecode, this is a little more advanced version where you can define Red's values used by the VID code. And the window is resizable.
Red [
Title: "Simple GUI livecoding demo"
Author: "Nenad Rakocevic / Didier Cadieu"
File: %livecode2.red
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 / lc.r
Created August 6, 2016 11:11 — forked from maximvl/lc.r
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 []
]