Skip to content

Instantly share code, notes, and snippets.

@TimeSeriesLord
TimeSeriesLord / red-updater.r
Created September 28, 2016 04:05 — forked from dockimbel/red-updater.r
Red-Updater-Script: This Script updates your Red Installation with the latest master-branch binaries.
Rebol [
Title: "Red-Updater-Script"
File: %red-updater.r
Author: "Neelesh Chandola, @nc-x"
Description: {
This Script updates your Red Installation with the latest master-branch binaries.
}
Instructions: {
Please update the variable `path-to-red-executable` with appropriate
location of the Red executable on your system before running the script.
@TimeSeriesLord
TimeSeriesLord / forskip.red
Created September 28, 2016 04:05 — forked from dockimbel/forskip.red
FORSKIP port from Rebol2 to Red.
Red [
Title: "FORSKIP function"
Author: "Nenad Rakocevic"
Purpose: "Direct port of the REBOL2 forskip function"
]
forskip: func [
"Evaluates a block for periodic values in a series."
'word [word!] "Word set to each position in series and changed as a result"
skip-num [integer!] "Number of values to skip each time"
Red [
Title: "Currency converter"
Author: ["Mark Summerfield" "Nenad Rakocevic"]
License: ["Apache 2.0" http://www.apache.org/licenses/LICENSE-2.0]
Version: 1.0.0
Needs: 'View
]
converter: context [
currencies: rates: usd: gbp: from: target: value: list: pos: e: none
@TimeSeriesLord
TimeSeriesLord / delimit.red
Created September 28, 2016 04:04 — forked from greggirwin/delimit.red
A `delimit` function for Red.
; This doesn't work like R3 in how negative widths work.
forskip: func [
"Evaluates a block at regular intervals in a series."
'word [word!] "Word referring to the series to traverse (modified)"
width [integer!] "Interval size (width of each skip)"
body [block!] "Body to evaluate at each position"
/local orig result op
][
either zero? width [none] [
; TBD: assert word refs series
;-- In %natives.reds
checksum*: func [
check? [logic!]
_tcp [integer!]
_hash [integer!]
_method [integer!]
_key [integer!]
/local
arg [red-value!]
@TimeSeriesLord
TimeSeriesLord / entab-detab.red
Created September 28, 2016 04:03 — forked from greggirwin/entab-detab.red
Red ENTAB/DETAB mezzanines
Red []
; Steeve gets credit for this one
detab: function [
"Converts leading tabs in a string to spaces. (tab size 4)"
string [any-string!] "(modified)"
/size
sz [integer!] "Number of spaces per tab"
/all "Change all, not just leading"
][
@TimeSeriesLord
TimeSeriesLord / invalid-utf8.red
Created September 28, 2016 04:01 — forked from greggirwin/invalid-utf8.red
Red invalid-utf8? function
invalid-utf?: function [
; https://robots.thoughtbot.com/fight-back-utf-8-invalid-byte-sequences
"Checks UTF encoding; if correct, returns none else position of error."
binary [binary!]
][
bad: [
#{C0} | #{C1} | #{F5} | #{F6} | #{F7} | #{F8} | #{F9} | #{FA}
| #{FB} | #{FC} | #{FD} | #{FE} | #{FF}
]
if parse binary [any [[mark: bad (return mark)] | skip]] [none]
@TimeSeriesLord
TimeSeriesLord / menu.red
Created September 28, 2016 03:57 — forked from greggirwin/menu.red
Basic Red menu demo
Red [
File: %menu.red
Author: "Gregg Irwin"
]
; The menu dialect in Red is easy. When making a face, you use `menu:`
; followed by a block of [string! block!] pairs, where the string is the
; text of the top level menu and the block is a simple dialect that
; defines the drop-down menu items. Each item can be either a string!
; followed by a word!, or the special separator marker of '---. That's it.
@TimeSeriesLord
TimeSeriesLord / trig-lab.red
Created September 28, 2016 03:57 — forked from greggirwin/trig-lab.red
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.
}
]
@TimeSeriesLord
TimeSeriesLord / math-lab.red
Created September 28, 2016 03:57 — forked from greggirwin/math-lab.red
Interactive math function laboratory
Red [
Title: "math-lab.red"
Author: "Gregg Irwin"
File: %math-lab.red
Needs: 'View
Purpose: {
Experiment, to see what an interactive "Lab" tool might look
like, for general language functions. i.e., take the idea of
font-lab, effect-lab, gradient-lab, etc., and apply it to
functions to aid in language discovery and learning.