Skip to content

Instantly share code, notes, and snippets.

View magurotuna's full-sized avatar
🍣
eating sushi

Yusuke Tanaka magurotuna

🍣
eating sushi
View GitHub Profile
// https://github.com/denoland/deno_doc/pull/105
export function f1(val1: A | B): val1 is A {}
export function f2(val2: any): asserts val2 is string {}
export function f3(val3: any): asserts val3 {}
export function assertIsDefined<T>(val4: T): asserts val4 is NonNullable<T> {
if (val === undefined || val === null) {
throw new AssertionError(
`Expected 'val' to be defined, but received ${val}`
);
}
@magurotuna
magurotuna / dns_test.rs
Last active January 18, 2021 17:04
dns test works
use std::collections::BTreeMap;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use std::str::FromStr;
use std::sync::Arc;
use std::sync::RwLock;
use std::time::Duration;
use tokio::net::TcpListener;
use tokio::net::UdpSocket;
use trust_dns_client::rr::LowerName;
@magurotuna
magurotuna / .commit_template
Last active November 25, 2019 16:08
Git Commit Template with Emoji
# ==================== Emojis ====================
# 🎉 :tada: 盛大に祝うべき大きな機能追加
# 🔖 :bookmark: バージョンタグ(Version Tag)
# ✨ :sparkles: 部分的な機能追加
# 👍 :+1: 機能改善
# 🐛 :bug: バグ修正(Bugfix)
# ♻️ :recycle: リファクタリング(Refactoring)
# 🚿 :shower: 不要な機能・使われなくなった機能の削除