Skip to content

Instantly share code, notes, and snippets.

class Money<T extends Money<T>> {
constructor(
private readonly _value: number
) {
}
equals(other: T) {
return this._value === other._value
}
class Money<T extends Money<T>> {
constructor(
private readonly _value: number
) {
}
equals(other: T) {
return this._value === other._value
}
enum MoneyType {
Dollar,
Yen
}
class Money {
constructor(
private readonly _value: number,
private readonly _type: MoneyType
) {}
// マーカーインターフェース
interface Money {
getValue(): number
}
class Dollar implements Money {
constructor(private readonly value: number) {}
getValue() {
return this.value
class Color {
constructor(
private red: number,
private green: number,
private blue: number
) { }
public equals(color: Color) {
return this.red === color.red &&
this.green === color.green &&
class Color {
constructor(
private red: number,
private green: number,
private blue: number
) { }
}
const appleColor = new Color(255, 0, 0)
const bloodColor = new Color(255, 0, 0)
const array = [1]
const anotherArray = [1]
const reference = array
console.log(array === reference) // true
console.log(anotherArray === reference) // false
const array = [1]
const anotherArray = [1]
console.log(array === anotherArray)
@harajune
harajune / value.ts
Last active August 12, 2022 01:22
value
const value = 1
const anotherValue = 1
console.log(value === anotherValue)
class PdfMerger:
def __init__(self, outputFileName):
self._merger = PdfFileMerger()
self._outputFileName = outputFileName
def append(self, pdf):
self._merger.append(fileobj=pdf.fileObject, pages=(pdf.currentPage, pdf.currentPage + 1))
def write(self):
self._merger.write(self._outputFileName)