Here is a collection of some older scripts I've written. They could be written more concisely and more robustly in the light of better experience with REBOL, but who has the time?
I figured it would nice to get REBOL to describe to me what a given bitset represented. While I was at it, it occurred to me that the best representation would be that used by the Charset function.
This one converts values of the tag! datatype into blocks suitable for use with the build-tag function. Thus it faciliates fiddling with the internals of a tag.
Because I've had too many years of SQL buzzing around my head I thought I would create a few cute functions like array-project, array-select and array-join. The functions work on data that is assumed to have the structure returned by the array function of REBOL.
Used by arrays-tools.r.
This script has some recursive directory handling. The intention is to make it work with urls and files. You can use it to generate scripts as well - see the directory-script function.
To use it you'll need:
This script doesn't actually have many conversions. What it does have is a function that produces a refined function. See the script for details. You can also refer to the deeper techniques page for a post that uses this function.
This script was a bit of an experiment. It was based on a script called parse-code.r written by Carl Sassenrath. It takes a REBOL script and breaks it into tokens. Each token is put on a seperate line and a comment is attached describing the type of the token. Ok, not very useful but it goes to show how REBOL is great for fiddling with programs.
A script that defines a few functions to do some simple html querying and manipulation. While it basically represents an experiment on dealing with HTML, you may find it quite useful for some quick HTML work. I have.
Here's an example, the service that hosts this site used to provide logs of site requests only as an HTML page! So I coded up some scripts that use html-tools.r to query the site and extract the base request data into an array. I then used array-tools.r to do some analysis the way I wanted to.
Another example, if you want to see all the links to scripts on this page try this:
script-page: http://www.codeconscious.com/rebol/rebol-scripts.html page-block: load-html script-page script-links: tags/attribute/value page-block 'href 'scripts map (func[x][to-url select x 'href]) script-links
The script needs tag-tool.r above, import-rebol-datatypes.r below and also the script highfun.r that can be downloaded from the script library at www.rebol.org.
This script goes uses html-tools.r to manipulate html files. While not necessarily a really general script it does show how one can use html-tools.r to fix links and other html elements.
Can be used to submit form requests by GET and POST.
Provides a facility to parse MIME messages. Or just get the attachments out. Will handle nested multipart messages such as that sent from BeOS mailer. I believe they could also be useful for handling http form upload data, though a more lean solution might be better for this case. Also handles uuencoded messages.
Here is a fairly complex parsing script. I was looking into the feasability of using Rich Text Format as an input source for a project I was working on. This script only gets as far as scanning RTF, not interpreting it (that is doing anything useful with it). And it should be treated as a work in progress (that stalled :-) ). If you get any use from this I would be very keen to know.
Another experiment. This was an exploration into parsing BNF grammar rules. Somewhat confusing when you attempt to write a grammar (parse rules) to parse a grammar. This is most likely buggy but might be an interesting example to play with so I've put it here.
I wanted to take Excel data and bring into into REBOL. So I thought of two ways. Tab delimted and comma delimited files. This script handles conversion to and from for both. The size of the script is due to the fact that I wanted to make sure that it handled quoted strings and add a bit of functionality related to formatting the data.
I wrote it a while ago, so I'm sure it can be made a lot more elegant.
Note that Excel sometimes puts out formatted numbers as quoted strings. This script does not attempt to interpret these - I'll leave that to you.
I use this script for uploading my scripts to my website. In the script I define two handy functions mime-write and mime-read. These functions do a write and a read respectively, but choose the binary function based on the extension of the file. The script defines the extensions.
To use it you'll need: