Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View taichi's full-sized avatar
😸
shaving...

taichi taichi

😸
shaving...
View GitHub Profile
@taichi
taichi / code_reading.md
Last active April 10, 2024 13:04
太一のコードの読み方メモ

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる
@taichi
taichi / code_review_basics.md
Last active March 5, 2024 08:29
チームでコードを書き始めた後、「どうやらレビューってやつをした方が良いらしい」くらいの若手に向けた資料です。

コードレビューの基本


一番大事な事

ソースコードはプロジェクトの共同所有物である

  • 誰かだけが触れるコードを無くす
@taichi
taichi / junit5_templates.xml
Created January 9, 2024 00:18
Code template for JUnit5 used in Eclipse.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="true" context="java-members" deleted="false"
description="JUnit5 - Test Method" enabled="true"
id="org.eclipse.jdt.ui.templates.junit5.test" name="test"><![CDATA[@${testType:newType(org.junit.jupiter.api.Test)}
void ${testName}() throws Exception {
${staticImport:importStatic('org.junit.jupiter.api.Assertions.*')}${cursor}
}]]></template>
<template autoinsert="true" context="java-members" deleted="false"
description="JUnit5 - Test Method with a temporary directory." enabled="true"
@taichi
taichi / README.md
Last active April 20, 2023 12:04
Modern Python development environment on top of Dev Container
@taichi
taichi / ShapeSortExample.java
Last active February 4, 2023 20:09
Excelのシートに配置されたオートシェイプを左上から順番にソートするコード
package com.example.hssf;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFSimpleShape;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.Test;
import java.io.File;
@taichi
taichi / .golangci.yml
Last active June 12, 2022 04:29
ロギングライブラリのあり方については別途要検討。zapやzerologを使うならファクトリ関数だけを置くようにした方がいいかも。
linters-settings: # 設定のデフォルト値は、https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml で確認できる
depguard: # packagesに宣言されているモジュールの取り扱いに関するルール。ブラックリスト形式で使っているので、列挙したものを使うとエラーになる。
list-type: blacklist
packages:
- golang.org/x/xerrors # go 1.13で必要な機能はすべてerrorsに取り込まれたので使わない
- github.com/rs/zerolog # ログ出力用のライブラリはプロジェクト内部に作ったファクトリ関数経由で使うため
packages-with-error-message:
- golang.org/x/xerrors: "エラー処理は標準のerrorsを使って下さい。スタックトレースが必要な場合のみpkg/errorsを使って下さい"
- github.com/rs/zerolog: "ログ出力は example.com/myproject/logger#Newから利用して下さい"
dupl: # コードのコピペを検出するルール。 閾値のトークン数を越えるものをエラーにする
@taichi
taichi / log.md
Last active December 15, 2021 02:12
ログ、その時の為に。
@taichi
taichi / LockFree.java
Created February 24, 2011 10:25
ConcurrentMap contains Set. feel easy but not.
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.ExecutorService;
@taichi
taichi / JavaSAM.java
Created February 28, 2016 14:11
Kotlin SAM type conversion
package aaa;
public interface JavaSAM {
String doIt(int i, String s);
static void call(JavaSAM ms) {
System.out.println(ms.doIt(1, "zzzz"));
}
}
@taichi
taichi / hello.test.ts
Created October 31, 2018 09:04
TypeScript + Jest + power-assert
import assert = require('assert');
it("hello", () => {
assert.equal({geeting:"WayWayWa", Fu:{Ho:1}},
{ greeting: "Hello", Fu:{Fe:1}});
});