Skip to content

Instantly share code, notes, and snippets.

View aiya000's full-sized avatar
🐶
Inu

aiya000 aiya000

🐶
Inu
View GitHub Profile
#!/bin/bash
# もし現在のgitブランチ(ここでfooとします。)がpushされていれば、{remote_name}/fooを返します。
# そうでなければこのブランチのルートとなるブランチ(分岐元)を取得し、それを返します。
#
# このプログラムはまず、リモート名を取得します。
# remoteが複数登録されている場合の適切な処理は未定義です。
# 現在は1番目のリモートを使用するようになっています。
# Returns tags and branches names of the root revision of current.
#!/bin/bash
# もし現在のgitブランチ(ここでfooとします。)がpushされていれば、{remote_name}/fooを返します。
# そうでなければこのブランチのルートとなるブランチ(分岐元)を取得し、それを返します。
#
# このプログラムはまず、リモート名を取得します。
# remoteが複数登録されている場合の適切な処理は未定義です。
# 現在は1番目のリモートを使用するようになっています。
# Returns tags and branches names of the root revision of current.
@aiya000
aiya000 / .gitignore
Last active September 1, 2024 09:31
.gitignore for VRChat avatar projects
# Created by https://www.toptal.com/developers/gitignore/api/unity
# Edit at https://www.toptal.com/developers/gitignore?templates=unity
### Unity ###
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#/[Ll]ibrary/
/[Tt]emp/
@aiya000
aiya000 / pre-push
Last active December 25, 2020 03:45
#!/bin/bash
root_dir=$(git rev-parse --show-toplevel)
remote_latest_branch=$(bash -c "$root_dir/scripts/get-root-branch.sh")
current_branch=$(git branch --show-current)
unpushed_files=$(git diff --stat "$remote_latest_branch..$current_branch" --name-only)
# Example usage: textlint for markdown
unpushed_markdown_files=$(echo "$unpushed_files" | grep '\.md$')
interface Foo {
x: number | string
}
interface Bar {
x: number
}
function main(): void {
const foo: Foo = {x: 10}
/**
* Exposes type utility functions.
* @packageDocumentation
*/
/**
* Does `x` have an undefined property `prop`,
* or that property is `PropType`?
*
* @example
/**
* Exposes type utility functions.
* @packageDocumentation
*/
/**
* Does `x` have an undefined property `prop`,
* or that property is `PropType`?
*/
export function haveUndefienedPropertyOrThat<
function hasUndefienedPropertyOrThat<
PropType,
Prop extends string,
Base extends { [P in Prop]?: PropType }
>(p: (x: PropType | undefined) => x is PropType, x: Base, prop: Prop): boolean {
return x[prop] === undefined || p(x[prop]);
}
// not nullish
function f(): number {
return 10
}
const x = f() ?? 20 // but ?? can use
console.log(x)
image: node:10.15.0
pipelines:
branches:
default:
- step:
name: Sanity check
caches:
- node
script: