$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ab -n 10 -c 10 -p json.file -T "application/json; charset=utf-8" http://localhost/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-1) | |
(use gauche.partcont) | |
(define (main args) | |
(reset | |
(let* ((p1 (shift k (call-with-input-file (second args) k))) | |
(p2 (shift k (call-with-output-file (third args) k)))) | |
(copy-port p1 p2)))) | |
;; -> "./vminsn.scm", line 1375: Assertion failed: SCM_PAIRP((vm)->handlers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; Freer monad in Scheme | |
;;;; See also | |
;;;; * "Freer monads, more extensible effects" | |
;;;; http://dl.acm.org/citation.cfm?doid=2804302.2804319 | |
;;;; * Free monad in Scheme https://gist.github.com/wasabiz/951b2f0b22643a59aeb2 | |
(use gauche.record) | |
(use util.match) | |
;;; data Freer f a where | |
;;; Pure :: a -> Freer f a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Requirement: higher, ppx_deriving.show | |
*) | |
(* | |
Lightweight higher-kinded polymorphism | |
https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf | |
*) | |
open Higher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!r6rs | |
(import (rnrs)) | |
;; R7RS 処理系で実行する場合は、上の行をコメントアウトし、 | |
;; 下の行のコメントを外す | |
;; (import (scheme base) (scheme write)) | |
;; R5RS 処理系で実行する場合は、ここから上をすべてコメントアウトする | |
;; From "Applicative syntax-rules: macros that compose better", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!r6rs | |
(import (rnrs)) | |
;; From "Applicative syntax-rules: macros that compose better", | |
;; http://okmij.org/ftp/Scheme/macros.html#ck-macros | |
(define-syntax ck | |
(syntax-rules (quote) | |
;; yield the value on empty stack | |
((ck () 'v) v) | |
;; re-focus on the other argument, ea |
Converting an SVG animation to a video with the MediaRecorder API and a hidden canvas.
Drawing frames from img
elements can introduce an extra delay, so this version generates all the frames upfront and then renders them in a loop with requestAnimationFrame()
.
See also: Canvas animation to video
パターンとはその言語が抽象化できなかった敗北の歴史である。 しかしどんなに優れた言語であってもあらゆる繰り返しに勝てるわけではない。 人は必ずメタ繰り返しを欲するからだ。 そしてそれはRustも例外ではない。
ここでは、OOPでも知られているパターンよりも、Rustに特有のパターンを思いつく限りまとめてみた。名前は適当。
- crate splitting
- でかいcrateを分割して、見通しを良くする・再コンパイルの分量を削減する・並列コンパイルを可能にする
- 親玉crate(全てにdependする)と殿crate(全てにdependされる)があることが多いので、だいたい束みたいな形になる。
OlderNewer