Skip to content

Instantly share code, notes, and snippets.

View lpvm's full-sized avatar

Luis Vale Mendes lpvm

  • Portugal
View GitHub Profile
@lpvm
lpvm / input.test07
Created December 16, 2018 17:23
lines of text
Step C must be finished before step A can begin.
Step C must be finished before step F can begin.
Step A must be finished before step B can begin.
Step A must be finished before step D can begin.
Step B must be finished before step E can begin.
Step D must be finished before step E can begin.
Step F must be finished before step E can begin.
Red [
Title: "Advent of Code 2018 - Day 07 - Part 01"
Date: 2018-12-15
File: %day07_part01.red
Author: "Luis Vale Mendes"
Version: 0.0.1
]
time-start: now/time/precise
@lpvm
lpvm / gist:77780cb47fc8ef9281ce6188260ccbc2
Created December 3, 2018 16:38
Parse multiple lines copying to block
i: "1#11^/2#22^/"
b: copy []
parse i [collect into b [copy l some digit "#" copy r some digit newline]]
; == false
probe l
; == "1"
probe r
; "11"
; == true
probe b
Red []
html: {
<html>
<head><title>Test</title></head>
<body><div><u>Hello</u> <b>World</b></div></body>
</html>
}
ws: charset reduce [space tab cr lf]
let insert db contact =
if db.number_of_contacts >= Array.length db.contacts then
(false, db, nobody)
else
let (status, db, _) = search db contact in
if status then (false, db, contact) else
let cells i =
if i = db.number_of_contacts then contact else db.contacts.(i)
in
let db' = {