Skip to content

Instantly share code, notes, and snippets.

View dockimbel's full-sized avatar

Nenad Rakocevic dockimbel

View GitHub Profile
anonymous
anonymous / .shen
Created October 27, 2016 13:56
\* Copyright (c) 2013, Willi Riha
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
@maximvl
maximvl / arg-spec.red
Last active December 14, 2016 05:55
An attempt to bring lambda-lists to Red
Red [
Title: "Untitled"
Author: "Maxim Velesyuk"
Version: 0.0.1
]
to-getword: func [w] [ load append copy ":" w ]
to-setword: func [w] [ to set-word! append copy "" w]
parse-spec: func [spec] [
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)
]
@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] [
@greggirwin
greggirwin / intuplate.red
Last active December 14, 2016 05:52
Tuple interpolation in Red
; It might seem like just a party trick, out of context. The goal is not "look how
; we can twist the language around!". Think, instead, of how you can use the language
; to most clearly express intent in different domains, or for different users. Quite
; often, when a user wants a different way to express things, we can accommodate them.
; It's also true that we can suggest a form that exists natively in Red, and they will
; be just as happy.
;
; Don't twist the language because you can. But don't be afraid to when it helps.
```
@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.
Red [
Title: "fry.red"
Author: ["Gregg Irwin" "Steeve"]
File: %fry.red
Purpose: {
Factor style fry combinators in Red
http://docs.factorcode.org/content/article-fry.html
works somewhat like a reverse collect/keep
}
]
@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 []
]
@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.
}
]
@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