Skip to content

Instantly share code, notes, and snippets.

@maximvl
maximvl / heart-animation.red
Created January 9, 2017 11:52 — forked from DideC/heart-animation.red
Heart animation for Red (only). Now with a complete control panel to play with the animations parameters. Nice time eater ;-)
Red [
title: "Heart animation"
author: "Didier Cadieu"
notes: {
Traduction in Red/Rebol of Terebus Volodymyr javascript demo : http://codepen.io/tvolodimir/pen/wqKuJ
}
Needs: View
]
;*** Settings
Red [
description: {
Attempt to copy Haiku Editor
http://forthsalon.appspot.com/haiku-editor
}
todo: {
* Optimize GUI
* Add memory and words: @ !
* Add return stack and words: push pop r@
* Add mouse handling: mx my button buttons
Red []
lines: read/lines %/etc/issue
; parse-row: func [row /local rule tmp] [
; rule: [any [copy x to tab skip (keep x)] copy x thru end (keep x)]
; tmp: collect reduce ['parse 'row rule]
; to-map compose [
; account (tmp/1)
@maximvl
maximvl / arg-spec.red
Last active December 14, 2016 05:55
An attempt to bring lambda-lists to Red
Red [
Title: "Untitled"
Author: "Maxim Velesyuk"
Version: 0.0.1
]
to-getword: func [w] [ load append copy ":" w ]
to-setword: func [w] [ to set-word! append copy "" w]
parse-spec: func [spec] [
@maximvl
maximvl / .red
Created August 6, 2016 17:18
@steveGit's version of LC in Red
Red []
lc: function [rule] [
parse rule [
some [
s: word! 'in skip
(in: last reduce/into ['foreach s/1 s/3 make block! 4] in)
| 'if skip
(in: last reduce/into ['if to-paren s/2 make block! 4] in)
| skip '|
@maximvl
maximvl / lc.r
Last active December 14, 2016 05:54
List comprehension dialect for Rebol
REBOL []
print []
lc: function [block] [lc-state lc-rule input-rule filter-rule i e] [
lc-state: make object! [
do-block: copy []
inputs: copy []
filter-block: none
input-state: copy []
res: copy []
]
REBOL []
find-until: function [series test] [res] [
res: copy []
forall series [
either not test first series [
append res first series
] [
break/return res
]
To exit, type \\
To remove this startup msg, edit q.q
q)S..t:".[`D;(;);{. y};S[]];S[.;`f]:9$D[]"
'S..t
q)S:D:.+(`a`b`c`d;4 6#,"")
'.
q)`show$`S
'type
q)
; Parsed manually from http://www.file-extensions.org/extensions/common-file-extension-list
; with code:
; function parseTable(t) { var c = t.children[0].children; var res = "(\"" + t.previousSibling.innerText + "\" . ("; for(e in c) { if(c[e].children == undefined) {continue} res += "\"" + c[e].children[0].children[1].innerText + "\" " } return res + "))";}
; tables = jQuery("table");
; res = "'("; tables.each(function(x, tab) { res += parseTable(tab); }); res += ")"; res
;
'(("Video files" . ("264" "3g2" "3gp" "arf" "asf" "asx" "avi" "bik" "dash" "dat" "dvr" "flv" "h264" "m2t" "m2ts" "m4v" "mkv" "mod" "mov" "mp4" "mpeg" "mpg" "mswmm" "mts" "ogv" "prproj" "rec" "rmvb" "swf" "tod" "tp" "ts" "vob" "webm" "wmv" ))("Audio files" . ("3ga" "aac" "aiff" "amr" "ape" "arf" "asf" "asx" "cda" "dvf" "flac" "gp4" "gp5" "gpx" "logic" "m4a" "m4b" "m4p" "midi" "mp3" "ogg" "pcm" "rec" "snd" "sng" "uax" "wav" "wma" "wpl" "zab" ))("Bitmap images" . ("bmp" "dds" "dib" "dng" "dt2" "emf" "gif" "ico" "icon" "jpeg" "jpg" "pcx" "pi
defmodule T.Behaviour do
defmacro __using__(_) do
quote do
@behaviour T.Behaviour
import T.Macros, only: [deftest: 2]
deftest :a do
IO.puts z
end