Skip to content

Instantly share code, notes, and snippets.

@crongro
crongro / _.js
Created October 4, 2018 01:09
_.js
const gpa = (function() {
const gpaTable = {'A+': 4.5, A: 4, 'B+': 3.5, B: 3, 'C+': 2.5, C: 2, D: 1, F:0};
let accumulatedScore = {total: 0, major: 0};
let accumulatedCredit = {total: 0, major: 0};
let lectureListArr = [];
return {
updateScoreAndCredit({major: isMajor, grade, credit}) { //전공여부, 학점, 평점 정보를 계산용 객체에 저장한다
accumulatedScore.total += gpaTable[grade] * credit;
accumulatedCredit.total += credit;
@crongro
crongro / async_order.js
Created July 16, 2018 12:23
async_order
console.log('script start');
requestAnimationFrame(()=> {
console.log("requestanimationframe");
})
const interval = setInterval(() => {
console.log('setInterval')
}, 0)
@crongro
crongro / todo.css
Last active September 4, 2018 03:25
todo_mvc_practice
.section-basic-style {
background-color: #a6d0d3;
padding: 1em;
}
.visible {
display : block!important;
}
.container {
@crongro
crongro / newsdata.json
Last active May 25, 2018 07:39
newslist
[{
"company": "경향신문",
"id":1,
"logoImgUrl": "https://s.pstatic.net/static/newsstand/up/2017/0424/nsd14372435.png",
"newslist": [
"유승민 “문재인 대통령도 특검 수사 대상”",
"홍준표 “난 사시미 테러도 당했다···주먹 따윈”",
"심상정 “문재인정부 A학점, 하지만···”",
"양주 가스폭발···종이에 '미안하다, 화장해달라’",
"LG그룹, 검찰 전격 압수수색에 당혹"
@crongro
crongro / regtest.js
Last active May 24, 2018 06:09
regtest
//아래처럼 출력되는 getDate함수를 만드세요.
//정규표현식을 사용합니다.
console.log(getDate("2019-11-2"));
//=> Mon Dec 02 2019 00:00:00 GMT+0900 (KST)
console.log(getDate("2017-3-1"));
console.log(getDate("2014-3-12"));
console.log(getDate("2014-3-"));//error
console.log(getDate("2014-3-32"));//error
@crongro
crongro / debug.js
Created May 24, 2018 01:02
debugging test
//2초뒤에 'codesquad'가 출력되도록 코드를수정하세요. (출력은 printMyname을 통해서 할 수 있음)
//(a,b객체를 직접 부를 수 없음. bind,call 등을 사용해야 함)
const a = {
run() {
setTimeout( ()=> {
const name = this.getName();
},1000);
@crongro
crongro / main.css
Last active May 11, 2018 19:08
main.html
div,header,ul,li,section,nav,footer,h1,h2,h3,h4 {margin:0;padding:0;}
li { list-style: none; }
a { text-decoration: none;}
.header,.mainArea > nav, .mainArea > .content, .newsList > ul{
padding:10px;
border: 1px solid #cccaca;
}
@crongro
crongro / todo.css
Last active April 18, 2018 08:00
fpstep
body > button {
margin: 2% 10%;
width: 200px;
height: 41px;
cursor: pointer;
font-size: 1.2em;
display: block;
}
.todoStatus {
@crongro
crongro / tabui_prototype_base_class.html
Created March 5, 2018 14:12
tabui_prototype_base_class.html
<html>
<header>
<link rel="stylesheet" href="tabui.css">
<style>
h2 {
text-align: center
}
h2,
h4 {
const fs = require('fs');
//functional util
const pipe = (...fns) => (value) => fns.reduce((acc, fn) => fn(acc), value);
const reduceByFun = (data) => (fun) => (initValue) => data.reduce((p,n) => fun(p,n), initValue);
//string utils
const trim = (s) => s.trim(s);
const removeNewLine = (s) => s.replace(/[\r\n]/g, '');