Skip to content

Instantly share code, notes, and snippets.

View yangtaeho's full-sized avatar

yangtaeho yangtaeho

View GitHub Profile
@yangtaeho
yangtaeho / 2_1_egypt_product.js
Last active April 28, 2022 15:03
study_algorithm_ramble_c2_220428
const odd = n=> !!(n & 0x1);
const half = n=>n >> 1;
{
// 내가 짠거
const odd = n=>half(n) == half(n - 1);
const half = n=>Math.floor(n/2);
}
{
// hika pp. 29
// n == parseInt(n/2) + parseInt(n/2); // 짝수인가? #1
@yangtaeho
yangtaeho / codeSpitzS89-6
Last active May 4, 2021 13:03
codeSpitzS89-6
if ('과제 210504 6강 끝나고 과제') {
`
과제 1 - 모든 값 타입을 인식하여 파싱하는 중첩된 배열 문자열 파서
"[2, \"ㄹㅏㄹ\", [2, \"ㅕㅕ\"], [3, "4"]]"
과제 2 - 나만의 클래스타입을 인식하여 해당 클래스의 인스턴스를 만들어 넣어주는 기능 추가
과제 3 - 기존 작성한 stringify 가 오브젝트인 경우 toJSON을 구현하고 있으면 그걸 이용해 stringify가 되도록 보수
과제 4 - date의 json인 경우 date로 복원한다
----> new Date().toJSON()
"2021-04-27T14:26:57.816Z"
@yangtaeho
yangtaeho / codeSpitzS89-5 과제 1
Last active April 27, 2021 12:47
codeSpitzS89-5 과제
if ('과제 1 - generator 는 습득이 0인 것 같아요....') {
let i = 0;
const copy = iter=>{
iter.filter = (block)=>copy((function*(){
for(const v of iter){
i++;
if(block(v)) yield v;
console.log('filter skip', v);
}
@yangtaeho
yangtaeho / codeSpitzS89-4
Last active April 27, 2021 11:58
codeSpitzS89-4
if ('과제 - 단수 obj stringify') {
Object.entries({}); //허용, 안쓰는 거 추천
`
const abc = {_1:3, b:"abc"}; //[] x, {} x
stringify(abc)==JSON.stringify(abc)
`
}
const stringify89_4_210420 = (obj => {
// utils ====================================================
@yangtaeho
yangtaeho / codeSpitzS89-3
Last active April 20, 2021 11:14
codeSpitzS89-3
const stringify89_3_210413 = (arr => {
// utils ====================================================
const isDebug =_=>!1;
const quote = str=>`\"${str}\"`;
const _escape = {
table: [[/\"/g,'\\\"']
,[/\t/g, '\\t']
,[/[\r]/g, '\\r']
,[/[\n]/g, '\\n']
@yangtaeho
yangtaeho / codeSpitzS89-2
Last active April 13, 2021 05:58
s*89-2 과제
const arrayStringify = (arr => {
const quote = str=>`\"${str}\"`;
const _escape = str=>str.replace(/\"/g,'\\\"');
const NULL_STR = 'null';
const _arrayStringify = (arr) => {
let acc = [];
for (const item of arr) {
//const item = obj[k];
//console.log('k', k, 'item', item);
//console.log('item', item);
@yangtaeho
yangtaeho / codeSpitzS89-1
Last active March 30, 2021 15:57
codeSpitzS89-1 과제
const makeArr = (s, max)=> {
let res = [];
for (let i = s; i <= max; i++) {
res.push(i);
}
return res;
};
console.log(makeArr(1, 10));
const err = e=>{throw e;};
const testF = (f, vList, logTitle = 'test')=>{
@yangtaeho
yangtaeho / fm2gp
Last active February 19, 2019 05:21
fm2gp 과제
#
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>76-1</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.circle-1 {
position: relative;
@yangtaeho
yangtaeho / attribute-parser.js
Last active January 29, 2018 18:59
codeSpitz 74-3 attribute 파서 추가(장황주의)
// ==== space test ====
let logL = {};
logL.deb = false;
logL.inf = false;
const attrStrTest = 'class= "test clazz" readonly title=test!! class="test clazz" style= "width : 150px ;height:50px"';
//getAttrList(attrStrTest);
const getAttrList = (attrStr) => {