Skip to content

Instantly share code, notes, and snippets.

@hohoonlee
hohoonlee / make_ticket.js
Created June 20, 2020 16:45
무작위 코드 생성하기
const num = '1,2,3,4,5,6,7,8,9'.split(',');
const ca = 'A,B,C,C,D,E,E,F,G,H,I,J,J,K,L,M,M,N,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'.split(',');
const all = [...num, ...ca];
const getRandomInt = (min, max) => {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //최댓값은 제외, 최솟값은 포함
};
@hohoonlee
hohoonlee / okky.css
Created March 2, 2020 12:28
OKKY CSS
.layout-container {
width: auto;
max-width: 100%;
margin-right: 150px;
padding-right: 150px;
}
.main {
width: 100%;
margin: 0 auto;
margin-left: 210px;

Creational Patterns (생성 패턴)

  • Abstract Factory : 구체적인 클래스를 지정하지 않고 관련성을 갖는 객체들의 집합을 생성하거나 서로 독립적인 객체들의 집합을 생성할 수 있는 인터페이스를 제공합니다.
  • Builder : 복합 객체의 생성 과정과 표현 방법을 분리함으로써 동일한 생성 공정이 서로 다른 표현을 만들 수 있게 한다.
  • Factory Method : 객체를 생성하는 인터페이스를 정의하지만, 인스턴스를 만들 클래스의 결정은 서브클래스가 한다. Factory Method 패턴에서는 클래스의 인스턴스를 만드는 시점을 서브클래스로 미룬다.
  • Prototype : 프로토타입의 인스턴스를 이용해서 생성할 객체의 종류를 명세하고 이 프로토타입을 복사해서 새로운 객체를 생성한다.
  • Singleton : 클래스의 인스턴스는 오직 하나임을 보장하며 이 인스턴스에 접근할 수 있는 방법을 제공한다.

Structural Patterns (구조 패턴)

  • Adapter : 클래스의 인터페이스를 클라이언트가 기대하는 다른 인터페이스로 변환한다. Adapter패턴은 호환성이 없는 인터페이스 때문에 함께 사용할 수 없는 클래스를 개조하여 함께 작동하도록 해준다.
  • Bridge : 추상화와 구현을 분리하여 각각을 독립적으로 변형할 수 있게 한다.
@hohoonlee
hohoonlee / 20190212.html
Created February 15, 2019 14:46
한붓그리기 1차
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
const generator = function*(i, j){
for(let ii = 1; ii <= i; ii++) {
for(let jj = 1; jj <= j; jj++) {
yield [ii, jj, ii * jj];
}
}
};
for(const [i, j, k] of generator(9,9)){
console.log(`${i} x ${j} = ${k}`);
@hohoonlee
hohoonlee / cloudSettings
Last active December 15, 2020 13:53
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-15T13:53:26.815Z","extensionVersion":"v3.4.3"}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
</style>
</head>
{
"title":"TIOBE Index for June 2017",
"header":["Jun-17","Jun-16","Change","Programming Language","Ratings","Change"],
"items":[
[1,1,"","Java","14.49%","-6.30%"],
[2,2,"","C","6.85%","-5.53%"],
[3,3,"","C++","5.72%","-0.48%"],
[4,4,"","Python","4.33%","0.43%"],
[5,5,"","C#","3.53%","-0.26%"],
[6,9,"change","Visual Basic .NET","3.11%","0.76%"],
@hohoonlee
hohoonlee / parser.js
Created January 18, 2018 08:25
코드스피츠 3회차
const addNode = (node, target) => {
if(!target.tag.children) target.tag.children = []
target.tag.children.push(node)
}
const makeNode = (type, text) => {
let result = {tag:{type}}
if (!text) return result
if(typeof text === 'string') {