summaryrefslogtreecommitdiff
path: root/src/content/pastebins/2021
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-03-31 21:51:40 -0300
committerEuAndreh <eu@euandre.org>2025-03-31 21:51:40 -0300
commit570ec471d1605318aeefb030cd78682ae442235b (patch)
tree51e17eabe37c6689f8799b55e6875c3480329a2c /src/content/pastebins/2021
parentMakefile, mkdeps.sh: Derive index.html and feed.xml from more static "sortdat... (diff)
downloadeuandre.org-570ec471d1605318aeefb030cd78682ae442235b.tar.gz
euandre.org-570ec471d1605318aeefb030cd78682ae442235b.tar.xz
src/content/: Update all files left to asciidoc
Diffstat (limited to 'src/content/pastebins/2021')
-rw-r--r--src/content/pastebins/2021/04/03/naive-slugify-js.adoc21
-rw-r--r--src/content/pastebins/2021/06/08/reading-session-pt1.adoc19
-rw-r--r--src/content/pastebins/2021/06/22/curl-wget.adoc24
-rw-r--r--src/content/pastebins/2021/08/11/h1-spacing.adoc62
-rw-r--r--src/content/pastebins/2021/09/02/sicp-3-19.adoc24
-rw-r--r--src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc37
6 files changed, 57 insertions, 130 deletions
diff --git a/src/content/pastebins/2021/04/03/naive-slugify-js.adoc b/src/content/pastebins/2021/04/03/naive-slugify-js.adoc
index f765495..648e5fa 100644
--- a/src/content/pastebins/2021/04/03/naive-slugify-js.adoc
+++ b/src/content/pastebins/2021/04/03/naive-slugify-js.adoc
@@ -1,20 +1,7 @@
----
+= JavaScript naive slugify
-title: JavaScript naive slugify
-
-date: 2021-04-03
-
-updated_at: 2021-08-15
-
-layout: post
-
-lang: en
-
-ref: javascript-naive-slugify
-
----
-
-```javascript
+[source,javascript]
+----
const s = "Pézão: açaí, saci-pererê.";
const slugify = s =>
@@ -37,4 +24,4 @@ const slugify = s =>
.replaceAll("ç", "c");
console.log(slugify(s));
-```
+----
diff --git a/src/content/pastebins/2021/06/08/reading-session-pt1.adoc b/src/content/pastebins/2021/06/08/reading-session-pt1.adoc
index b97ef08..d9f1f91 100644
--- a/src/content/pastebins/2021/06/08/reading-session-pt1.adoc
+++ b/src/content/pastebins/2021/06/08/reading-session-pt1.adoc
@@ -1,18 +1,7 @@
----
+= Debit Reading Session - SICP solutions pt.1
-title: Debit Reading Session - SICP solutions pt.1
-
-date: 2021-06-08
-
-layout: post
-
-lang: en
-
-ref: debit-reading-session-sicp-solutions-pt-1
-
----
-
-```scheme
+[source,scheme]
+----
;; 1.41
(define (double f)
(lambda (x)
@@ -72,6 +61,6 @@ ref: debit-reading-session-sicp-solutions-pt-1
;;; 2.32
TODO
-```
+----
FYI: I just typed those in, I didn't yet test them yet.
diff --git a/src/content/pastebins/2021/06/22/curl-wget.adoc b/src/content/pastebins/2021/06/22/curl-wget.adoc
index 1030c7b..08caf12 100644
--- a/src/content/pastebins/2021/06/22/curl-wget.adoc
+++ b/src/content/pastebins/2021/06/22/curl-wget.adoc
@@ -1,20 +1,9 @@
----
-
-title: "cloc: curl and wget"
-
-date: 2021-06-22
-
-layout: post
-
-lang: en
-
-ref: cloc-curl-and-wget
-
----
+= "cloc: curl and wget"
`curl`:
-```shell
+[source,shell]
+----
$ pushd `mktemp -d`
/tmp/tmp.AZkwvk7azD ~/
$ git clone git://github.com/curl/curl .
@@ -62,11 +51,12 @@ TOML 1 0 0
------------------------------------------------------------------------------------
SUM: 1309 39501 56083 254078
------------------------------------------------------------------------------------
-```
+----
`wget`:
-```shell
+[source,shell]
+----
$ pushd `mktemp -d`
/tmp/tmp.NX0udlJMiz ~/
$ git clone git://git.savannah.gnu.org/wget.git .
@@ -99,4 +89,4 @@ lex 1 29 65 73
--------------------------------------------------------------------------------
SUM: 342 11400 14185 52018
--------------------------------------------------------------------------------
-```
+----
diff --git a/src/content/pastebins/2021/08/11/h1-spacing.adoc b/src/content/pastebins/2021/08/11/h1-spacing.adoc
index 9a00ece..e8a6986 100644
--- a/src/content/pastebins/2021/08/11/h1-spacing.adoc
+++ b/src/content/pastebins/2021/08/11/h1-spacing.adoc
@@ -1,29 +1,17 @@
----
+= Spaces around h1 tags
-title: Spaces around h1 tags
+// FIXME updated_at: 2021-08-15
-date: 2021-08-11
+_EDIT_: Apparently, the behaviour below is consistent between Firefox and
+Chromium for links, but not for `<h1>`. My conclusion is that the `<h1>`
+behaviour is a Firefox quirk, but the `<a>` is expected.
-updated_at: 2021-08-15
-
-layout: post
-
-lang: en
-
-ref: spaces-around-h1-tags
-
----
-
-*EDIT*: Apparently, the behaviour below is consistent between Firefox and
-Chromium for links, but not for `<h1>`.
-My conclusion is that the `<h1>` behaviour is a Firefox quirk, but the `<a>` is
-expected.
-
----
+'''''
The HTML below has selectable extra spaces after `<h1>` tags:
-```html
+[source,html]
+----
<!DOCTYPE html>
<html lang="en">
<head>
@@ -43,23 +31,22 @@ The HTML below has selectable extra spaces after `<h1>` tags:
</main>
</body>
</html>
-```
+----
The rendered output is:
-<h1>
- With spaces around when selecting this heading
-</h1>
-<h1>Without spaces around</h1>
-<p>
- Is this expected behaviour?
-</p>
+With spaces around when selecting this heading
+
+Without spaces around
----
+Is this expected behaviour?
+
+'''''
The same with links:
-```html
+[source,html]
+----
<!DOCTYPE html>
<html lang="en">
<head>
@@ -80,17 +67,10 @@ The same with links:
</main>
</body>
</html>
-```
+----
The rendered output is:
-<p>
- <a href="#">
- With extra underlined space
- </a>
- after the link.
-</p>
-<p>
- <a href="#">Without extra underlined space</a>
- after the link.
-</p>
+With extra underlined space after the link.
+
+Without extra underlined space after the link.
diff --git a/src/content/pastebins/2021/09/02/sicp-3-19.adoc b/src/content/pastebins/2021/09/02/sicp-3-19.adoc
index 75ee346..f6aa8cf 100644
--- a/src/content/pastebins/2021/09/02/sicp-3-19.adoc
+++ b/src/content/pastebins/2021/09/02/sicp-3-19.adoc
@@ -1,18 +1,7 @@
----
+= SICP exercise 3.19
-title: SICP exercise 3.19
-
-date: 2021-09-02
-
-layout: post
-
-lang: en
-
-ref: sicp-exercise-3-19
-
----
-
-```scheme
+[source,scheme]
+----
(define (cycle? l)
(define (rec l x)
(cond
@@ -20,11 +9,12 @@ ref: sicp-exercise-3-19
((eq? l x) true)
(true (rec l (cdr x)))))
(rec l (cdr l)))
-```
+----
Sample interactive session:
-```scheme
+[source,scheme]
+----
scheme@(guile-user)> (define true #t)
scheme@(guile-user)> (define false #f)
scheme@(guile-user)>
@@ -39,4 +29,4 @@ scheme@(guile-user)> (cycle? '(1 2 3))
$9 = #f
scheme@(guile-user)> (cycle? (make-cycle '(1 2 3)))
$10 = #t
-```
+----
diff --git a/src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc b/src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc
index 8cf7ea2..2b4a8a2 100644
--- a/src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc
+++ b/src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc
@@ -1,36 +1,25 @@
----
+= SICP persistent amortized O(1) queue
-title: SICP persistent amortized O(1) queue
-
-date: 2021-09-03
-
-layout: post
-
-lang: en
-
-ref: sicp-persistent-amortized-o1-queue
-
----
-
-```scheme
+[source,scheme]
+----
(define (queue)
(cons '()
- '()))
+ '()))
(define (enqueue x q)
(cons (car q)
- (cons x (cdr q))))
+ (cons x (cdr q))))
(define (flush q)
(cons (reverse (cdr q))
- '()))
+ '()))
(define (dequeue q)
(if (null? (car q))
(dequeue (flush q))
(cons (caar q)
- (cons (cdar q)
- (cdr q)))))
+ (cons (cdar q)
+ (cdr q)))))
(define (empty? q)
(and (null? (car q))
@@ -43,7 +32,7 @@ ref: sicp-persistent-amortized-o1-queue
(define (rec l leading-space?)
(when (not (null? l))
(when leading-space?
- (display " "))
+ (display " "))
(display (car l))
(rec (cdr l) #t)))
@@ -52,10 +41,12 @@ ref: sicp-persistent-amortized-o1-queue
(rec (reverse (cdr q)) (not (null? (car q))))
(display ")")
(newline))
-```
+----
Sample interactive session:
-```scheme
+
+[source,scheme]
+----
scheme@(guile-user)> (define true #t)
scheme@(guile-user)> (define false #f)
scheme@(guile-user)> (define q (queue))
@@ -82,4 +73,4 @@ scheme@(guile-user)> (print-queue q)
#q(b c d e)
scheme@(guile-user)> (print-queue (cdr (dequeue (cdr (dequeue (enqueue 'g (enqueue 'f q)))))))
#q(d e f g)
-```
+----