This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red[ | |
Title: "Where" | |
Purpose: "Find where function is defined" | |
Author: "Boleslav Březovský" | |
] | |
where: function [ | |
"Return file where function is defined or NONE, if the definition can't be found" | |
'name | |
/in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
mal-scalar: [ | |
any whitespace [ | |
p: (probe p) | |
"nil" keep ('nil) | |
| "true" keep ('true) | |
| "false" keep ('false) | |
| tmp: mal-number keep (to-integer tmp) | |
| tmp: mal-string keep (tmp) | |
| tmp: mal-keyword keep (to-get-word tmp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red[] | |
count-lines: func [ | |
filename | |
/local | |
file count ws | |
][ | |
ws: charset " ^-" | |
file: read/lines filename | |
count: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("%main.js"); | |
rooms = null; | |
users = null; | |
// load room names | |
load_rooms = function (){ | |
d3.csv("data/room-list.csv", function(error, data) { | |
if (error) throw error; | |
console.log("loading rooms"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red[] | |
reduce+: func [ | |
"Reduce with unset!, error! -> none! conversion" | |
block | |
/local value new-block | |
][ | |
new-block: block | |
collect [ | |
until [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
file: %base32.red | |
date: 17-Sep-2015 | |
author: "Graham Chiu" | |
red-version: "Boleslav Březovský" | |
version: 0.0.3 | |
notes: { | |
encodes string to base32 or base32hex | |
padding to 5 characters is not required in this method | |
>> to-base32/decode/hex to-base32/hex "yessir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "Replace with /CASE support" | |
] | |
replace: func [ | |
"Returns the series where a value is found, or NONE. " | |
series [series!] | |
pattern | |
value | |
/all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red[] | |
join: func [ | |
"Reduce values in a block and joins them into a string" | |
block [block!] | |
/with "Add delimiter between values" | |
delimiter | |
/trim "Remove NONE values" | |
] [ | |
if empty? block [return ""] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "Nsource - native source" | |
Purpose: "Print source for native functions" | |
Author: "Boleslav Březovský" | |
Date: "8-6-2017" | |
] | |
indent: func [ | |
"(Un)indent text by tab" | |
string [string!] "Text to (un)indent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
inc-value: func [ | |
face | |
color-id | |
dest-face | |
/local value rate | |
] [ | |
unless face/extra [face/font/color: 255.255.255] | |
overflow?: false |