Skip to content

Instantly share code, notes, and snippets.

Gregg Irwin greggirwin

  • FullStack Technologies
Block or report user

Report or block greggirwin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@greggirwin
greggirwin / load-time-type-tally.red
Created Aug 5, 2019
Red Load-Time and Type Tally
View load-time-type-tally.red
Red [
file: %load-time-type-tally.red
purpose: {
Load a Red file, noting how long it takes to do so,
then parse it and tally all the values by datatype.
It's not a metric that may prove useful, but in
aggregate, we could see what types are most commonly
used.
I'll correct my own thinking. After just a few sample
@greggirwin
greggirwin / vid-across-below-align.red
Last active Sep 1, 2019
VID across/below alignment demo
View vid-across-below-align.red
Red []
view [
style chk: check "Option" data yes
style vline: base 2x60 red
across top vline button "Ok" text "Text" field chk return
across middle vline button "Ok" text "Text" field chk return
across bottom vline button "Ok" text "Text" field chk
]
View r2-mapping-lib.r
REBOL []
;!! This is very much a work in progress, with many things untested. It needs
; to be clear what is functional and break out R&D bits into a working script
; for that purpose.
;-------------------------------------------------------------------------------
Arcsin: func [X [decimal!]] [
;'Arcsin(X) = Atn(X / Sqr(-X * X + 1)) [from MS Help - VB4, 1995]
View incr-decr.red
Re: WRT: func ['name content][]
WRT incr {
The most common case will be to change state, but incr does add meaning, and has
benefits, in my mind, when used with scalars.
- By default, there is no step value, so you can't get the + 1 part wrong.
- Incr is often used when looping, making loop variables stand out from other add
ops that might be in expressions.
@greggirwin
greggirwin / url-parser-tests.red
Last active Oct 24, 2018
RFC3986 URL parser and separate tests
View url-parser-tests.red
Red []
do %url-parser.red
test-urls: reduce [
foo:// ; no path
object [
scheme: 'foo
user-info: none
host: "" ; none ; this is tricky, the // means we'll always have a host, even if empty.
@greggirwin
greggirwin / url-parser.red
Last active Aug 14, 2019
Red URL Parser (now included in Red: %environment/networking.red)
View url-parser.red
Red [
title: "RFC3986 URL parser"
file: %url-parser.red
author: "@greggirwin"
date: 03-Oct-2018
notes: {
Reference: https://tools.ietf.org/html/rfc3986#page-16
Most rule names are taken from the RFC, with the goal of
making it easy to compare to the reference. Some rules
@greggirwin
greggirwin / inject.red
Last active Mar 4, 2020
INJECT func experiment. Alternative to REDUCE or COMPOSE.
View inject.red
Red [
name: 'inject
file: %inject.red
author: "Gregg Irwin"
notes: {
Red version of Ladislav Mecir's R2 `build` func. I can't find his on
the net, to link to, but can post his original if desired. His point
was that `compose` isn't always easy to use, when parens are part of
block you're composing, or how your blocks are structured, whether you
can use `/only` with `compose`. e.g.
@greggirwin
greggirwin / join-combine.red
Created Aug 8, 2018
Red JOIN/COMBINE mezzanine ideas
View join-combine.red
Red []
; TBD: pair tuple
combine: func [
"Merge values, modifying a if possible"
a "Modified if series or map"
b "Single value or block of values; reduced if `a` is not an object or map"
][
if all [block? :b not object? :a not map? :a] [b: reduce b]
case [
View foreach-face-probe.red
win: layout [
title "VID test"
;below
text "Hello"
button "Hello" 100x40 [bar/data: random 100%]
button "World"
return
button "China"
text "Red Language" 100 right
@greggirwin
greggirwin / bezier-tweens.red
Last active Jul 28, 2018 — forked from toomasv/bezier-tweens.red
Bezier `curve`-based tweening
View bezier-tweens.red
Red [
Author: "Toomas Vooglaid"
Date: 2018-07-27
Purpose: {Study of bezier-based tweens}
File: %bezier-tweens.red
Needs: 'View
]
down-flags: [down1? down2? down3? down4? b1-down? b3-down?] ;down?
clear-down-flags: does [set down-flags off]
You can’t perform that action at this time.