Skip to content

Instantly share code, notes, and snippets.

View BumpeiShimada's full-sized avatar
🏊‍♂️
meditating

curryisdrink BumpeiShimada

🏊‍♂️
meditating
View GitHub Profile
## DIRECTORY
mkdir [dir]
create directory
@BumpeiShimada
BumpeiShimada / inheritance.java
Last active November 8, 2016 00:29
スーパークラスとサブクラスについての最低限のまとめ ref: http://qiita.com/BumpeiShimada/items/938cdee35d0a213434a3
abstract class Player {
public abstract void play();
public void loop(int n) {
for (int i = 0; i < n; i++) {
play();
}
}
}
import java.util.ArrayList;
import java.util.List;
public class ArrayListSample {
public static void main(String args[]) {
//ArrayListの生成とデータのセット
List<String> al = new ArrayList<String>();
al.add("A");
@BumpeiShimada
BumpeiShimada / tipsForImplementingLogin.md
Last active October 5, 2017 23:47
ログイン処理実装時に考えること

ログイン処理実装時の注意

  • セッションはログインするごとに変えること。
    ホテルのPCとかでハイジャックできるようになってしまうので。
  • ただ、前のセッションをちゃんと引き継いであげるのも忘れないこと。
    そうしないと、例えばアマゾンで購入時にログインしたらカートの中身が消えてしまったりする。
  • 一定の時間(5分ぐらい?)がたったら、セッションに格納されたユーザーがログイン可能かどうか確認する。 強制退会にした人でもセッションがある限りはログインできてしまうので。
  • ログインが成功した時にログイン履歴も残るようにしよう。
    ただ、それでお客さんを待たせるのはあれなので、インサート処理は非同期で。
    これをしなかったリージョンアップはログインに50分近くかかってしまうように。。
@BumpeiShimada
BumpeiShimada / td-agent.conf
Created August 28, 2018 09:53
How to notify errors through td-agent immediately, only sending counts of certain acknowledged errors daily.
# Retrieve Error Log
<source>
type tail
path {{ path }}
format multiline
format_firstline /^\d{4}-\d{2}-\d{2}/
format1 /^(?<text>.*)/
tag raw.app.errorlog.{{ hostname }}
pos_file /var/tmp/app_log.pos.slack
</source>
- name: install fluent plugins use fluent-gem
gem: name=fluent-plugin-{{ item.name }} version={{ item.version }} executable=/usr/sbin/td-agent-gem user_install=no
with_items:
- { name: 'forest', version: '' }
- { name: 'jsonbucket', version: '' }
- { name: 'rewrite-tag-filter', version: '1.6.0' }
notify:
- restart td-agent
when: td_agent_conf is defined
@BumpeiShimada
BumpeiShimada / jestDataTable.txt
Created October 16, 2018 14:42
A data table example of Jest's describe.each
str | expected
${null} | ${true}
${""} | ${true}
${"word"} | ${false}
export function isEmpty(str) {
return (!str || 0 === str.length);
}
describe('isEmpty method with the argument', () => {
const validate = require('./validate');
describe.each`
str | expected
${null} | ${true}
${""} | ${true}
${"word"} | ${false}
`('$str', ({str, expected}) => {
test(`returns ${expected}`, () => {
/**
* The base class for validating EventForm data
*/
public interface BaseValidator {
// Argument "errors" should be replaced with error handling class.
// In actual case, when "errors" are not empty a program detect it and understand that there are errors.
void validate(EventForm form, List<String> errors);
ValidateType getValidateType();