Skip to content

Instantly share code, notes, and snippets.

View hanachin's full-sized avatar
🌺
OKA

Seiei Miyagi hanachin

🌺
OKA
View GitHub Profile
@hanachin
hanachin / file0.txt
Created October 21, 2018 23:33
SATySFiでリストを書く・連結する・分割する ref: https://qiita.com/hanachin_/items/366c856c21cc6f8504d7
@require: stdja
let-inline ctx \unwrap joint =
match joint with
% matchで分割できる
| weed :: paper :: [] -> read-inline ctx (embed-string (weed ^ `と` ^ paper))
| _ -> read-inline ctx (embed-string `ここに到達することはない`)
let-inline ctx \smoke joint =
% letでも分割できる
@hanachin
hanachin / file0.txt
Created October 20, 2018 02:55
SATySFiで可変な変数を使う ref: https://qiita.com/hanachin_/items/15429c41886ec29d700f
@require: stdja
let-mutable count <- 0
let-inline \counter =
let c = !count in
let () = count <- !count + 1 in
embed-string (arabic c)
in
@hanachin
hanachin / file0.txt
Created October 18, 2018 03:03
SATySFiでデフォルト引数書くときOptional.fromがべんり ref: https://qiita.com/hanachin_/items/cf02f4e653afe095cd3e
@require: option
@require: stdja
let-inline ctx \sugoi ?:prefix s =
let p = Option.from `すごい` prefix in
read-inline ctx (embed-string (p ^ s))
in
document (|
author = { Seiei MIYAGI };
@hanachin
hanachin / file0.txt
Created October 18, 2018 02:39
SATySFiでoptionalな型をつける方法 ref: https://qiita.com/hanachin_/items/94cca2b593faed5a8a39
@require: stdja
let-inline ctx \sugoi ?:prefix s =
let p = match prefix with
| None -> `すごい`
| Some(p) -> p
in
read-inline ctx (embed-string (p ^ s))
in
@hanachin
hanachin / highlight.rb
Created October 9, 2018 04:18
SATySFi で Ruby のソースコードをシンタックス ハイライトする ref: https://qiita.com/hanachin_/items/bebb875f36e7ac3e7368
require "iro"
using Module.new {
refine(Array) do
def type
self[0]
end
def lineno
self[1] - 1
@hanachin
hanachin / same.pdf
Created October 8, 2018 13:13
SATySFiのモジュールのdirectで宣言したinline-cmdの名前が被ったときの対処法 ref: https://qiita.com/hanachin_/items/90d5962c4ea18b99955f
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hanachin
hanachin / local.satyh
Created September 28, 2018 15:02
SATySFi 0.0.2でなんかエラーになる
@require: math
let fizzbuzz =
let ctx = get-initial-context 10pt (command \math) in
page-break
A4Paper
(fun pbinfo -> (|
text-height = 0pt;
text-origin = (0pt, 0pt);
|))
@hanachin
hanachin / file0.txt
Last active August 9, 2018 03:54
rubyは1..でzip出来るのでチル ref: https://qiita.com/hanachin_/items/c313ff6573e1bbca3446
fruits = ['apple', 'orange', 'melon']
fruits.zip(1..) {|fruit, i| puts "#{i}: #{fruit}" }
# 1: apple
# 2: orange
# 3: melon
require 'with_refinements'
module Ext
refine Integer do
def asdjflk
"ujihisa #{self}"
end
end
end