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
import { | |
createSourceFile, | |
forEachChild, | |
isCallExpression, | |
isIdentifier, | |
isNoSubstitutionTemplateLiteral, | |
isVariableStatement, | |
visitNode, | |
ScriptTarget, | |
Node, |
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
function enqueuePostPromiseJob(fn) { | |
// Promise.resolve().then(fn) | |
// でも似たような動きになるが別のpromiseの解決に依存してexecを呼ばなければならない関数が同一の実行スケジュールから漏れてしまうため | |
// 次のフェーズの最速で呼ばれる nextTick で実行したほうが同一スケジュールでより多くの処理をすることができる。 | |
// これをコメントインすると `dependOtherAsyncFuncExec` が別のバッチスケジュールで呼ばれることが確認できる | |
// フェーズについて: https://blog.hiroppy.me/entry/nodejs-event-loop | |
Promise.resolve().then(() => { | |
// nextTick の理由: https://github.com/graphql/dataloader/issues/180 | |
process.nextTick(fn); |
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
package main | |
import ( | |
"cloud.google.com/go/firestore" | |
"time" | |
"fmt" | |
"reflect" | |
"strings" | |
) |
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
import { Bucket, File } from '@google-cloud/storage'; | |
type AtomicFileMvReturnType = [{ src: File; dest: File }, Error | undefined]; | |
const atomicFileMv = async ( | |
bucket: Bucket, | |
srcPath: string, | |
destPath: string | |
): Promise<AtomicFileMvReturnType> => { | |
const src = bucket.file(srcPath, { generation: 0 }); | |
const dest = bucket.file(destPath, { generation: 0 }); |
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
def pipe(arg) | |
->(fn = nil) { !fn.nil? && fn.is_a?(Proc) ? pipe(fn.call(arg)) : arg } | |
end | |
# usage | |
pipe(1) | |
.call(->(arg) { arg + 1 }) | |
.call(->(arg) { arg * 3 }) | |
.call |
- 上記ファイルを同じディレクトリに配置してビルドする
$ docker build -t convertNotoToTTF .
- otf ファイルがあるディレクトリ上で先ほどの docker image を実行する
- otf の拡張子を除いたファイル名がフォント名としてセットされるようになっている
- ライセンス上オリジナルのフォント名から変更しなければいけないので otf ファイル名を予め別の名前にリネームしておく
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
// ジェネレータを使うとイテレートしているリストを増やしたり逆に減らしたりすることができるのでキュー管理と並列実行をテーマとしたサンプル | |
const pararell = 2 | |
const queues = [1, 2, 3, 4] | |
const runner = (taskManager) => | |
new Promise(r => { | |
const queue = taskManager.next() | |
if (queue.done) { | |
r() |
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
import * as React from 'react'; | |
import { StyledComponent, StyledComponentProps } from 'styled-components'; | |
export type ExtractStyledComponentProps<SC> = SC extends StyledComponent< | |
infer C, | |
infer T, | |
infer O, | |
infer A | |
> | |
? StyledComponentProps<C, T, O, A> & { |
NewerOlder