Skip to content

Instantly share code, notes, and snippets.

View ya-s-u's full-sized avatar
🍺
Drinking

Yasuaki Goto ya-s-u

🍺
Drinking
View GitHub Profile
@ya-s-u
ya-s-u / findInBatches.ts
Created June 27, 2023 16:55
Prisma extensions
import { Prisma } from '@prisma/client'
interface Omit {
<T extends object, K extends [...(keyof T)[]]>(obj: T, ...keys: K): {
[K2 in Exclude<keyof T, K[number]>]: T[K2]
}
}
const omit: Omit = (obj, ...keys) => {
const ret = {} as {
@ya-s-u
ya-s-u / parser.ts
Created March 3, 2022 14:14
パーサーコンビネータ
interface Done<T> {
type: 'done';
result: T;
tail: string;
};
interface Failed {
type: 'failed';
};
@ya-s-u
ya-s-u / gist:7c04d8dc40b012d9e4924946ddc1c45a
Created November 5, 2019 05:12 — forked from jmblog/gist:6077993
所得税と住民税の計算方法

所得税(国税)

所得税の計算方法

所得税額 = (所得金額(A) - 所得控除額(B)) × 税率 - 税額控除額(C)

  • 「所得金額(A)- 所得控除額(B)」は 課税所得金額 といい、1,000円未満の端数を切り捨てる。

所得税の税率

@ya-s-u
ya-s-u / appstate.txt
Created February 15, 2018 07:42
AppState
+------------------------------------------------+
| active |
+------------------------------------------------+
^ |
| |
didBecomeActive willResignActive
| |
| v
+------------------------------------------------+
| inactive |
@ya-s-u
ya-s-u / StoryboardInstantiatable.swift
Last active January 4, 2018 00:53
StoryboardInstantiatable
//: Playground - noun: a place where people can play
import UIKit
protocol ContextInjectable {
associatedtype Context = Void
func inject(_: Context)
}
extension ContextInjectable where Context == Void {
@ya-s-u
ya-s-u / UITabBar+.swift
Created July 2, 2017 03:01
UITabBar.unselectedItemTintColorをiOS9以下でも使えるようにする
import UIKit
extension UITabBar {
private struct AssociatedKey {
static var unselectedItemTintColor = "UITabBar.UnselectedItemTintColor"
}
@nonobjc
var unselectedItemTintColor: UIColor? {
@ya-s-u
ya-s-u / parser.swift
Last active November 29, 2017 09:04
パーサーコンビネータ
//
// ParserCombinator
//
// Created by 後藤誉昌 on 2016/10/06.
//
import Foundation
// モナド
struct Parser<Input, Output> {
@ya-s-u
ya-s-u / api.md
Created April 2, 2016 05:46 — forked from koba04/api.md
Vue.js note(v0.10.3). not translate. This is draft of https://github.com/koba04/vuejs-book .

API

Class: Vue

  • Vueはvue.jsのコアとなるコンストラクタ
  • インスタンスが作られたときにデータバインディングが開始される
  • オプションを取ることも出来て、DOMやデータやメソッドについて定義出来る
@ya-s-u
ya-s-u / Gemfile
Last active February 21, 2016 14:41
BeeAppを支える技術
ruby '2.2.3'
source 'https://rubygems.org'
#source 'https://rails-assets.org' do
# gem 'rails-assets-vue'
#end
gem 'rails', '4.1.7'
gem 'grape'
gem 'kaminari'
@ya-s-u
ya-s-u / index.html
Last active November 21, 2015 07:52
Newspaper Layout
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>11月21日(土)の朝刊</title>
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="style.css">
</head>