[ Launch: test ] 5424eda38a9909236db2 by toomasv[ Launch: test ] 4653053 by enjalot[ Launch: test ] 4652017 by enjalot[ Launch: test ] 4582399 by enjalot
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 [Author: "Toomas Vooglaid" | |
Adapted-from: "split" | |
Date: "2017-04-23" | |
Version: "0.1" | |
] | |
split-block: func [ | |
{Break a block into pieces using the provided delimiter} | |
series [block! hash!] dlm [string! char! bitset! any-word! any-block!] /local s num | |
][ | |
num: either any-block? dlm [length? dlm] [1] |
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 [ | |
Author: "Toomas Vooglaid" | |
Date: "2017-05-05" | |
Needs: {Examples may use `fill.red` by Gregg Irwin (https://gitter.im/red/red/welcome?at=590b4daac93941e153c94b8e) | |
or as adapted by me (https://gitter.im/red/red/welcome?at=590cae8d33e9ee771c793966)} | |
] | |
to-blocks: func [ | |
{Splits a block into more or less equal chuncks} | |
blk [block!] {Initial block to split} | |
num [integer!] {Number of resulting chuncks} |
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 [ | |
Author: "Gregg Irwin" | |
File: "%fill.red" | |
Source: "Gitter @greggirwin " | |
Reference: ":point_up: [May 4, 2017 6:50 PM](https://gitter.im/red/red/welcome?at=590b4daac93941e153c94b8e)" | |
Changed-by: "Toomas Vooglaid" | |
Changed-date: "2017-05-05" | |
Change: "Added 'justify and helper 'x'" | |
] | |
x: make op! func [n c][pad/with copy "" n to char! c] |
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 [ | |
Author: "Toomas Vooglaid" | |
Date: "2017-05-07" | |
Changed: "2018-07-09" | |
Purpose: "Print a directory tree" | |
File: "%dir-tree.red" | |
] | |
context [ | |
; Some helpers | |
get-char: func [hex][to-char to-integer hex] |
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 [ | |
Author: "Toomas Vooglaid" | |
file: "%regex.red" | |
Purpose: {Regex to parse converter} | |
History: {Started: 2017-05-09 | |
v.0.1: 2017-05-12 -- first working version with: | |
start `^^` and end `$` anchors, | |
non-capturing groups (one level) with alterns, | |
quantifiers (possessive), | |
some character-classes. |
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 [ | |
Author: "Toomas Vooglaid" | |
file: "%regex~.red" | |
Purpose: {Perl-like regex for Red} | |
History: { | |
Started: 2017-05-30 from %regex.red | |
2017-05-31 Improved pattern. Now simple matches with no modes can be done wo delimiters. | |
eg. "abcbba" ~ "^^[abc]+$" | |
2017-06-01 Some minor changes in code from regex.red | |
} |
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: {Find recent feats} | |
Usage: {`feats 30` -- find 30 latest feats | |
`see 5` -- see 5th feat's code | |
} | |
Needs: {To improve readability you can use `to-columns` | |
(https://gist.github.com/toomasv/464bd3bc775b75ce734bebf6d7aca190) | |
} | |
] | |
context [ |
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: {Find feats through github-api.v3} | |
Author: {Toomas Vooglaid} | |
Started: {2017-06-27} | |
Needs: { | |
* rebolek's http-tools (https://github.com/rebolek/red-tools/blob/master/http-tools.red) | |
* my regex~ (https://github.com/toomasv/regex/blob/master/regex~.red) | |
* my to-columns (https://gist.github.com/toomasv/464bd3bc775b75ce734bebf6d7aca190) | |
* github access token | |
} |
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
reverse: func [ | |
series /skip size /part length /local i tuple | |
][ | |
switch type?/word series [ | |
pair! [return to-pair reduce [series/2 series/1]] | |
tuple! [tuple: clear [] repeat i length? series [append tuple pick series i] series: copy tuple tuple: yes] | |
] | |
size: any [size 1] | |
either 0 = ((length? series) % size) [ | |
length: any [length length? series] |
OlderNewer