Skip to content

Instantly share code, notes, and snippets.

@siritori
siritori / CreateClass.java
Created May 27, 2014 02:02
情報科学I
class Disp
{
void display() {
System.out.println("No argument");
}
void display(String s) {
System.out.println(s);
}
void display(String s, int n) {
System.out.println(s + ", " + n);
@siritori
siritori / index.haml
Created November 14, 2014 01:46
複素関数論 マンデルブロ集合
!!!html5
%html
%body
%form{:action => '.', :method => 'get'}
width
%input{:name => 'width', :value => @params['width']}
height
%input{:name => 'height', :value => @params['height']}
fineness
%input{:name => 'fineness', :value => @params['fineness']}
public class ProductMain {
public boolean executeMain(ResourceHolder resourceholder) {
Log log = BCLogFactory.getLog(ProductMain.class);
CommonPrinter commonPrinter = null;
Statement statement = null;
ResultSet resultSet = null;
try {
String outputileName = resourceHolder.getOutputFileName();
commonPrinter = new CommonPrinter(outputFileName, "UTF-8");
Connection connection = resourceHolder.getConnection();
class PartialUpdate<Props>
{
constructor(protected props: Props) {
PartialUpdate.deepFreeze(this);
}
private static deepFreeze(o: any) {
Object.freeze(o);
var oIsFunction = typeof o === "function";
type updator<T> = (prev: T) => T;
class PartialUpdate<Props>
{
private _props: Props;
protected get props(): Props {
return this._props;
}
constructor(props: Props | updator<Props>, prev?: Props) {
@siritori
siritori / CallbackStreamBuffer.hpp
Created October 6, 2019 22:09
std::basic_streambufを使って独自streamを作る
#pragma once
/**
* @brief コールバックストリームバッファ
* @note 出力をバッファリングし、書き込み用の関数をコールバックする
*/
class CallbackStreamBuffer : public std::basic_streambuf<char>
{
/**
* @brief 親クラス
@siritori
siritori / main.cpp
Created November 10, 2019 10:54
SegmentTreeによるRMQ
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <list>
@siritori
siritori / jsonArchive.cpp
Created February 4, 2020 22:32
SFINEでオーバーロード
#include <functional>
#include <iostream>
#include <vector>
#include <map>
#include <initializer_list>
class JsonArchive {
public:
explicit JsonArchive(std::ostream &stream)
@siritori
siritori / srp.md
Last active November 10, 2020 13:59

単一責任の原則 (SRP)

意味

1つのクラス・モジュール・関数を変更する理由は1つ以上存在してはならない。

なぜこの原則がある?

  • いろいろなものをモックしないといけないのでテストしづらくなる
  • 1つ修正したときに周辺確認がやたら多くなり工数が増える
import { EventEmitter, Injectable } from '@angular/core';
import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
import { ComponentPortal, ComponentType } from '@angular/cdk/portal';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
export interface DialogNeed<Return> {
close$: EventEmitter<Return>;
}