Skip to content

Instantly share code, notes, and snippets.

View mbutterick's full-sized avatar

Matthew Butterick mbutterick

View GitHub Profile
#lang racket
(require rackunit pollen/decode pollen/template/html)
(define str "Крикну — а в ответ тишина.")
(define (wrap-emdashes str)
;; define match pattern
;; one or more Unicode letters followed by space emdash space
;; letter pattern is parenthesized to produce submatch for word
(define pat #px"(\\p{L}+) — ")
@mbutterick
mbutterick / amaze.rkt
Created November 30, 2019 14:30
Example of using Racket graph library to generate mazelike things
#lang racket/base
(require graph racket/match racket/list racket/sequence)
(require racket/draw racket/gui)
(define (cell-up c) (list (car c) (sub1 (cadr c))))
(define (cell-right c) (list (add1 (car c)) (cadr c)))
(define (cell-down c) (list (car c) (add1 (cadr c))))
(define (cell-left c) (list (sub1 (car c)) (cadr c)))
@mbutterick
mbutterick / faq.pdf.pm
Created January 24, 2020 20:59
Pollen + Quad example
#lang pollen
◊subhead{MB Type}
◊subhead{Frequently Asked Questions}
◊subsubhead{The #1 most frequently asked question}
◊qa{I'm a Windows user. I installed the standard OpenType fonts, but they don’t appear correctly in PDFs made with the PDF generator built into WordPerfect or Word on Windows.
This is a ◊link["http://typo.la/wordpdf"]{known limitation} of WordPerfect and Word on Windows. Switching to the OpenType TT fonts will cure the problem. So will switching to other PDF-making software, such as the Adobe PDF printer driver, which is included with Adobe Acrobat. (This advice does not apply to Mac OS.)}