REBOL3 - reblets (working reblets (50-100 lines or less) [web-public])

Return to Index Page
Most recent messages (300 max) are listed first.

#UserMessageDate
5AmmonREBOL [ File: %scramble.r Author: "Ammon Johnson" Email: ammon.johnson@gmail.com Version: 0.0.1 History: [ 0.0.1 31-Mar-2009 "scrambles and descrambles code" ] ]

scramble: context [ words: [] load-words: does [ foreach word first system/words [ add-word mold word ] ] add-word: func [ word /local chars length ][ chars: charset word unless found? find words chars [repend words [chars copy []]] unless found? find words/:chars length: length? word [repend words/:chars [length copy []]] length: select words/:chars length unless found? find length word [insert tail length word] word ] get-word: func [ word /local chars length ][ chars: charset word unless chars: select words chars [return "UNKNOWN"] unless length: select chars length? word [return "UNKNOWN"] random/only length ] scramble: func [ txt /local result ][ result: parse/all txt " " forall result [ unless empty? trim copy result/1 [change result random add-word result/1] ] form result ] descramble: func [ txt /local result ][ result: parse/all txt " " forall result [ unless empty? trim copy result/1 [change result get-word result/1] ] form result ] ]

1-Apr-09 5:07
4Maximbug creep: parens disapeared for some strange reason... replace in the above:

btn 200 left (label) [ explore-dir to-local-file item get in (to-word setw) 'data ]

with

btn 200 left (label) [ explore-dir (to-local-file item) get in (to-word setw) 'data ]

20-Mar-09 3:32
3Maximrebol [ title: "explore.r" version 1.0 date: 2009-03-19 author: "Maxim Olivier-Adlhoch" copyright: "2009(c)Maxim Olivier-Adlhoch" tested: "win xp" notes: "Add any dir to the dirs block. options are self explanatory" ]

dirs: [ %/C/ [] %"/C/program files/" [expand] "%tmp%" [label "temp dir"] "" [ label "my documents"] ]

blk: []

explore-dir: func [path expand? /local cmd][ call/shell rejoin [" explorer " either expand? ["/n,/e,"]["/n,"] path ] ]

ctr: 1 foreach [item opts] dirs [ ctr: ctr + 1 expand?: found? find opts 'expand label: any [select opts 'label to-local-file item] append blk compose/deep [ pad 20 (to-set-word setw: rejoin ["dir" ctr]) check (expand?) pad 20 btn 200 left (label) [ explore-dir to-local-file item get in (to-word setw) 'data ] ] append blk 'return ]

view layout compose [across vtext right "expand?" vtext "folder" return (blk)]

20-Mar-09 2:47
2Maximhi all, I thought we'd build a small group, where we can just dump small working (fun or usefull) reblets.

rules are simple: * ~ 50 -100 lines or less... * complete script with header * no external libs a part from urls on rebol.org * no use of write or save command * runs as-is in view 2.7.6 * we discuss scripts in reblets-discussion

20-Mar-09 2:45
1xavier.20-Mar-09 2:44

Return to Index Page