Skip to content

Instantly share code, notes, and snippets.

View iArnold's full-sized avatar

iArnold iArnold

  • Freelance ICT Specialist
  • Netherlands
View GitHub Profile
@iArnold
iArnold / eval2.red
Last active April 11, 2018 15:03 — forked from dockimbel/eval2.red
Test script for Red/View Android backend
Red [
Title: "Red Android bridge demo"
Author: "Nenad Rakocevic"
File: %eval2.red
Config: [type: 'dll libRed?: no libRedRT?: yes export-ABI: 'cdecl]
Tabs: 4
Needs: 'View
Rights: "Copyright (C) 2013-2017 Nenad Rakocevic. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
Red [
Author: "Toomas Vooglaid"
Date: 25-9-2017
Description: {Experiments with L-System}
]
ctx: context [
scale: origin: length: len: angle: width: delta-width: times-length: delta-length: delta-angle: aliasing?: stack: commands: none
defaults: [
scale 2.0
origin 300x500
Red []
set-iso-week: function [
"Returning a new date set on the first day of that week for a given date and weeknumber"
date [date!]
/week weeknumber [integer!]
/local resultdate ordinal jan4 dec31 daysinyear daysinlastyear
][
jan4: dec31: resultdate: now/date
jan4/day: 4
jan4/month: 1
@iArnold
iArnold / gist:2ef23f8d16c002c96934a1c8015e4ec6
Created June 30, 2017 09:51
Squareroot in Lisp en Red
; https://repl.it/languages/scheme
(define (abs x)
(cond ((> x 0) x)
((= x 0) 0)
((< x 0) (- x))))
(define (average x y)
(/ (+ x y) 2))
@iArnold
iArnold / get-date
Created May 9, 2017 12:18
Red date retrieve
get-date: function [
"Get date from unixtimestamp.com"
return: [string!]
/local
page
datestring [string!]
datearray
][
page: read http://www.unixtimestamp.com/index.php
get-today-rule: [ thru {seconds since Jan 01 1970. (UTC)} thru {<h3 class="text-danger">} copy datestring to " @ " to end]
@iArnold
iArnold / dir-tree.red
Created May 8, 2017 09:46 — forked from toomasv/dir-tree.red
Print a directory tree
Red [
Author: "Toomas Vooglaid"
Date: "2017-05-07"
Changed: "2017-05-08"
Purpose: "Print a directory tree"
File: "%dir-tree.red"
]
context [
; Some helpers
get-char: func [hex][to-char to-integer hex]
Red [
Title: "CSV Handling Tools"
Author: "Brian Hawley"
File: %csv-tools.red
Date: "20-Mar-2017"
Version: 1.2.0
Purpose: "Loads and formats CSV data, for enterprise or mezzanine use."
Library: [
level: 'intermediate
platform: 'all
@iArnold
iArnold / %grep.red
Created November 25, 2016 22:09 — forked from meijeru/%grep.red
Red [
Title: "Partial grep implementation"
Purpose: {To search the input for lines containing a match
to the given pattern, specified as a regular expression}
Author: "Rudolf W. MEIJER"
File: %grep.red
Version: 0.4.0
Date: "24-Nov-2016"
Rights: "(c) Copyright 2016 Rudolf W. MEIJER"
History: [
@iArnold
iArnold / maskinput
Last active November 4, 2016 13:37
Masked input
Red [
filename: %maskinput.red
date: "4-Nov-2016"
Needs: 'View
]
star-replace: func [
num
/local stars
][
@iArnold
iArnold / tabtest.red
Created October 18, 2016 11:00
How to go about adding tab functionality?
;do %/c/../tabtest.red ;-- Everything before the Red header is not a comment!!
Red [
file: %tabtest.red
]
window-actors: object [ ;-- actors for the window
on-key: func [face [object!] event [event!]][
case [
event/key = #"^-" [
print "TAB key caught by window face!"