Skip to content

Instantly share code, notes, and snippets.

View greggirwin's full-sized avatar

Gregg Irwin greggirwin

  • Redlake Technologies
View GitHub Profile
@hiiamboris
hiiamboris / into.red
Last active February 22, 2023 18:49
Could INTO be a separate function without breaking the language semantics and/or vastly complicating the interpreter?
Red [title: "An experiment with INTO separation"]
; do %/d/devel/red/common/with.red
buffers*: []
into: func [buffer [series!]] [append/only buffers* buffer exit]
collect': function [code [block!]] [
also buffer: any [
take/last buffers*
@q60
q60 / red.rst
Last active August 16, 2021 18:02
Red shields.io badges
@hiiamboris
hiiamboris / lagometer.red
Last active January 28, 2021 16:51
lagometer
Red [needs: view]
img: draw 4000x2000 [scale 2 2 fill-pen yello circle 1000x500 1000 500]
lag: object [max: avg: 0.0]
offset: 0x0
plot: []
system/view/auto-sync?: off
view/no-wait [
below
@9214
9214 / scrape.red
Last active August 19, 2024 04:18
The world's smallest web scraper.
Red [
Title: "A Parse-based port of Michael Gilliland's web scraper"
Author: @9214
Date: 16-Oct-2020
Link: https://youtu.be/HDMa4gcgEgI
]
page: read-thru/binary to url! system/script/args
link: [copy match [ahead https:// url!]]
rule: [collect any [link keep (to url! match) | skip]]
Red [needs: 'view]
; frog
; https://opengameart.org/content/frog-player-spritesheets
; background
; https://opengameart.org/content/several-scrolling-backgrounds-and-layerable-runners
frog-sprites: #{
89504E470D0A1A0A0000000D4948445200000100000000800806000000E4B5B7
@mjgpy3
mjgpy3 / links.red
Created June 13, 2020 14:28
Red Links
@toomasv
toomasv / intermediate.red
Last active June 25, 2021 10:07
Show intermediate values of expression in console
Red [
Description: "Show values of intermediate expressions"
Date: 12-Jun-2020
]
term: gui-console-ctx/terminal
show: function [][
out2: copy [] out: pos: copy []
found: find/tail term/line "show "
@toomasv
toomasv / range-pre-load.red
Last active June 23, 2020 05:29
Mimick range and bound syntax
Red [
Description: "Pre-load to mimic range/bounds syntax"
Date: 22-May-2020
Author: @toomasv
]
context [
default-start: func [stop step][
case [
any [percent? stop percent? :step][1%]
any [pair? stop pair? :step][1x1]
@toomasv
toomasv / range-ops.red
Last active May 24, 2020 07:21
Range and step ops
Red [
Description: "Some range and step ops"
Date: 21-May-2020
]
;Simple range op!
;works when a < b and with integer! and date! only
..: make op! func [a [integer! date!] b [integer! date!] /local i out][
out: copy [] repeat i b - a + 1 [append out i - 1 + a]
]
@Oldes
Oldes / html-entities.red
Last active May 13, 2020 10:05
HTML entities
Red [
Title: "HTML entities"
Purpose: "To decode HTML entities in a text"
Author: "Oldes"
Date: 12-May-2020
Version: 1.0.2
License: MIT
Usage: [
"Test: ♠ & ¢ <a> and Δδ ¾" =
decode-html-entities {Test: &spades; & &#162; &lt;a&gt;&#32;and &Delta;&delta; &frac34;}