Skip to content

Instantly share code, notes, and snippets.

@pei0804
pei0804 / README.md
Last active April 8, 2021 13:04
code-rule
  • 推測が必要なコードになってないか
  • もっとシンプルに書けないか
    • コードは読む時間のほうが長い
  • 読む時にIDEを開きたくならないか
  • 早すぎる最適化が行われてないか
  • コードから仕様が見えるか
    • どうしても見えない時はコメントを書く
  • 不安な部分がないか
  • クラス、メソッドは一言で説明できるか
  • 参照透過性があるか
@pei0804
pei0804 / README.md
Last active March 13, 2024 08:45
pei0804 profile
package main
import (
"fmt"
"log"
"net/http"
)
type simpleHandler struct{}
// 分割代入
// 従来
var numbers = [1, 2, 3];
var a = numbers[0];
var b = numbers[1];
var c = numbers[2];
a;
b;
c;
@pei0804
pei0804 / yrkt.md
Last active February 4, 2019 09:01
2019年yrkt
@pei0804
pei0804 / Future.scala
Created December 30, 2018 08:16
ScalaFuture
import scala.concurrent.{Await, Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Random, Success}
object Example1 extends App {
def sleep(time: Long) { Thread.sleep(time) }
implicit val baseTime = System.currentTimeMillis
// 別スレッドで計算開始
@pei0804
pei0804 / autoexec.cfg
Created September 26, 2018 11:17
csgo config
cl_interp "0"
cl_interp_ratio "1"
cl_interpolate "1"
cl_lagcomp_errorcheck "1"
cl_lagcompensation "1"
rate "786432"
cl_cmdrate "128"
cl_updaterate "128"
snd_mixahead "0.025"
fps_max "300"
@pei0804
pei0804 / either.scala
Last active November 28, 2018 07:40
scala
object Main {
def main(args: Array[String]): Unit = {
val v1: Either[String, Int] = Right(123)
val v2: Either[String, Int] = Left("abc")
v1 match {
case Right(i) => println(i)
case Left(s) => println(s)
} // 123
package tdd
import (
"fmt"
"reflect"
)
// Semver a
type Semver struct {
major uint
# General API Info
| annotation | description |example |
|--------------------|----------------------------------------------------------|---------------------------------|
| title | **Required.** The title of the application. | // @title Swagger Example API |