summaryrefslogtreecommitdiff
path: root/src/content/pastebins/2021
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/pastebins/2021')
-rw-r--r--src/content/pastebins/2021/04/03/naive-slugify-js.adoc28
-rw-r--r--src/content/pastebins/2021/06/08/reading-session-pt1.adoc66
-rw-r--r--src/content/pastebins/2021/06/22/curl-wget.adoc92
-rw-r--r--src/content/pastebins/2021/08/11/h1-spacing.adoc75
-rw-r--r--src/content/pastebins/2021/09/02/sicp-3-19.adoc33
-rw-r--r--src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc76
6 files changed, 0 insertions, 370 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
deleted file mode 100644
index 184ce97..0000000
--- a/src/content/pastebins/2021/04/03/naive-slugify-js.adoc
+++ /dev/null
@@ -1,28 +0,0 @@
-= JavaScript naive slugify
-:updatedat: 2021-08-15
-
-[source,javascript]
-----
-const s = "Pézão: açaí, saci-pererê.";
-
-const slugify = s =>
- s
- .toLowerCase()
- .replaceAll(":", "")
- .replaceAll(".", "")
- .replaceAll(",", "")
- .replaceAll("-", "")
- .replaceAll("á", "a")
- .replaceAll("ã", "a")
- .replaceAll("à", "a")
- .replaceAll("é", "e")
- .replaceAll("ê", "e")
- .replaceAll("í", "i")
- .replaceAll("ó", "o")
- .replaceAll("ô", "o")
- .replaceAll("ú", "u")
- .replaceAll("ü", "u")
- .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
deleted file mode 100644
index d9f1f91..0000000
--- a/src/content/pastebins/2021/06/08/reading-session-pt1.adoc
+++ /dev/null
@@ -1,66 +0,0 @@
-= Debit Reading Session - SICP solutions pt.1
-
-[source,scheme]
-----
-;; 1.41
-(define (double f)
- (lambda (x)
- (f (f x))))
-
-
-:;; 1.42
-(define (compose f g)
- (lambda (x)
- (f (g x))))
-
-
-;;; 1.43
-(define (repeated f n)
- (if (= 1 n)
- identity
- (comp (repeated f (dec n)))))
-
-
-;;; 2.27
-(define (map-tree node-fn leaf-fn tree)
- (cond
- ((null? tree) tree)
- ((not (pair? tree)) (leaf-fn tree))
- (else
- (node-fn
- (cons (map-tree node-fn leaf-fn (car tree))
- (map-tree node-fn leaf-fn (cdr tree)))))))
-
-(define (map-nodes f tree)
- (map-tree f identity tree))
-
-(define (deep-reverse x)
- (map-nodes reverse x))
-
-
-;;; 2.28
-(define (flatten tree)
- (define (rec acc t)
- (cond
- ((null? t) acc)
- ((not (pair? t)) (cons t acc))
- (else
- (rec (rec (cdr t) acc)
- (car t)))))
- (rec nil tree))
-
-
-;;; 2.30
-(define (square-tree tree)
- (map-leaves square tree))
-
-
-;;; 2.31
-(define square-tree map-leaves) ; ha!
-
-
-;;; 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
deleted file mode 100644
index 97f55c7..0000000
--- a/src/content/pastebins/2021/06/22/curl-wget.adoc
+++ /dev/null
@@ -1,92 +0,0 @@
-= "cloc: curl and wget"
-
-`curl`:
-
-[source,sh]
-----
-$ pushd `mktemp -d`
-/tmp/tmp.AZkwvk7azD ~/
-$ git clone git://github.com/curl/curl .
-Clonage dans '.'...
-remote: Enumerating objects: 167029, done.
-remote: Counting objects: 100% (925/925), done.
-remote: Compressing objects: 100% (372/372), done.
-remote: Total 167029 (delta 590), reused 818 (delta 548), pack-reused 166104
-Réception d'objets: 100% (167029/167029), 75.63 Mio | 9.33 Mio/s, fait.
-Résolution des deltas: 100% (131415/131415), fait.
-$ cloc .
- 3386 text files.
- 3342 unique files.
- 2084 files ignored.
-
-github.com/AlDanial/cloc v 1.90 T=1.34 s (973.7 files/s, 260104.4 lines/s)
-------------------------------------------------------------------------------------
-Language files blank comment code
-------------------------------------------------------------------------------------
-C 535 25645 36361 135318
-XML 23 21 20 45997
-m4 29 1526 1976 16972
-Perl 56 2611 4010 15411
-C/C++ Header 223 4178 10109 13794
-Markdown 53 2784 0 7038
-Visual Studio Solution 27 0 21 5049
-D 242 398 0 3549
-CMake 34 754 1288 3056
-DOS Batch 7 293 370 1554
-YAML 18 115 171 1493
-make 21 296 660 1440
-Bourne Shell 22 326 633 1136
-Pascal 2 228 0 634
-Python 4 196 221 628
-Visual Basic Script 1 30 60 341
-C++ 3 58 69 169
-Gencat NLS 1 2 0 130
-TNSDL 1 3 0 113
-Windows Resource File 2 17 47 110
-Bourne Again Shell 1 17 44 97
-Protocol Buffers 1 2 0 28
-diff 1 0 0 11
-Lisp 1 1 23 7
-TOML 1 0 0 3
-------------------------------------------------------------------------------------
-SUM: 1309 39501 56083 254078
-------------------------------------------------------------------------------------
-----
-
-`wget`:
-
-[source,sh]
-----
-$ pushd `mktemp -d`
-/tmp/tmp.NX0udlJMiz ~/
-$ git clone git://git.savannah.gnu.org/wget.git .
-Clonage dans '.'...
-remote: Counting objects: 52248, done.
-remote: Compressing objects: 100% (18430/18430), done.
-remote: Total 52248 (delta 23879), reused 52248 (delta 23879)
-Réception d'objets: 100% (52248/52248), 13.11 Mio | 6.18 Mio/s, fait.
-Résolution des deltas: 100% (23879/23879), fait.
-$ cloc .
- 12210 text files.
- 11629 unique files.
- 11876 files ignored.
-
-github.com/AlDanial/cloc v 1.90 T=1.26 s (270.4 files/s, 61357.4 lines/s)
---------------------------------------------------------------------------------
-Language files blank comment code
---------------------------------------------------------------------------------
-C 53 6596 8955 34084
-Perl 106 1832 870 7415
-Python 105 1481 2374 5318
-C/C++ Header 43 704 1153 1486
-Bourne Shell 11 308 311 1278
-m4 3 172 183 940
-make 9 136 172 522
-YAML 3 27 13 515
-Bourne Again Shell 6 78 89 274
-Markdown 2 37 0 113
-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
deleted file mode 100644
index 38dbb2e..0000000
--- a/src/content/pastebins/2021/08/11/h1-spacing.adoc
+++ /dev/null
@@ -1,75 +0,0 @@
-= Spaces around h1 tags
-:updatedat: 2021-08-15
-
-_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:
-
-[source,html]
-----
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>Spaces around h1 tags</title>
- </head>
- <body>
- <main>
- <h1>
- With spaces around when selecting this heading
- </h1>
- <h1>Without spaces around</h1>
- <p>
- Is this expected behaviour?
- </p>
- </main>
- </body>
-</html>
-----
-
-The rendered output is:
-
-With spaces around when selecting this heading
-
-Without spaces around
-
-Is this expected behaviour?
-
-'''''
-
-The same with links:
-
-[source,html]
-----
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>Spaces after a tags</title>
- </head>
- <body>
- <main>
- <p>
- <a href="#">
- With extra underlined space
- </a>
- </p>
- <p>
- <a href="#">Without extra underlined space</a>
- </p>
- </main>
- </body>
-</html>
-----
-
-The rendered output is:
-
-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
deleted file mode 100644
index 166170f..0000000
--- a/src/content/pastebins/2021/09/02/sicp-3-19.adoc
+++ /dev/null
@@ -1,33 +0,0 @@
-= SICP exercise 3.19
-:categories: lisp programming-languages
-
-[source,scheme]
-----
-(define (cycle? l)
- (define (rec l x)
- (cond
- ((null? x) false)
- ((eq? l x) true)
- (true (rec l (cdr x)))))
- (rec l (cdr l)))
-----
-
-Sample interactive session:
-
-[source,scheme]
-----
-scheme@(guile-user)> (define true #t)
-scheme@(guile-user)> (define false #f)
-scheme@(guile-user)>
-(define (cycle? l)
- (define (rec l x)
- (cond
- ((null? x) false)
- ((eq? l x) true)
- (true (rec l (cdr x)))))
- (rec l (cdr l)))
-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
deleted file mode 100644
index 2b4a8a2..0000000
--- a/src/content/pastebins/2021/09/03/sicp-persistent-queue.adoc
+++ /dev/null
@@ -1,76 +0,0 @@
-= SICP persistent amortized O(1) queue
-
-[source,scheme]
-----
-(define (queue)
- (cons '()
- '()))
-
-(define (enqueue x q)
- (cons (car 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)))))
-
-(define (empty? q)
- (and (null? (car q))
- (null? (cdr q))))
-
-(define (peek q)
- (car (dequeue q)))
-
-(define (print-queue q)
- (define (rec l leading-space?)
- (when (not (null? l))
- (when leading-space?
- (display " "))
- (display (car l))
- (rec (cdr l) #t)))
-
- (display "#q(")
- (rec (car q) false)
- (rec (reverse (cdr q)) (not (null? (car q))))
- (display ")")
- (newline))
-----
-
-Sample interactive session:
-
-[source,scheme]
-----
-scheme@(guile-user)> (define true #t)
-scheme@(guile-user)> (define false #f)
-scheme@(guile-user)> (define q (queue))
-scheme@(guile-user)> (print-queue q)
-#q()
-scheme@(guile-user)> (print-queue (enqueue 'a q))
-#q(a)
-scheme@(guile-user)> (print-queue q)
-#q()
-scheme@(guile-user)> (set! q (enqueue 'a q))
-scheme@(guile-user)> (print-queue q)
-#q(a)
-scheme@(guile-user)> (set! q (enqueue 'e (enqueue 'd (enqueue 'c (enqueue 'b q)))))
-scheme@(guile-user)> (print-queue q)
-#q(e d c b a)
-scheme@(guile-user)> (peek q)
-$28 = a
-scheme@(guile-user)> (define ret (dequeue q))
-scheme@(guile-user)> (define value (car ret))
-scheme@(guile-user)> (set! q (cdr ret))
-scheme@(guile-user)> value
-$29 = a
-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)
-----