Skip to content

Instantly share code, notes, and snippets.

@crongro
crongro / tabUI.css
Last active July 1, 2016 06:34
tabUI
header,nav,section,div,footer,ul,dd {margin:0;padding:0;}
li{list-style: none;}
dt {
font-weight: bold;
font-size: 1.2em;
margin-bottom: 5px;
}
dl {
float: left;
@crongro
crongro / data.js
Last active December 30, 2016 08:43
object data sample
[
{"id" : 23, "name" : "honux", "content" : "오늘의 커피는 왜 항상 맛있지?", "like" : 2, "comment" : ["^^", "i like this"]},
{"id" : 55, "name" : "nigayo", "content" : "드디어 출근!", "like" : 4, "comment" : ["이직 하셨나봐요? "]},
{"id" : 93, "name" : "jk", "content" : "어제 읽은 책이 아직도 ", "like" : 20, "comment" : ["잠자기 전에 만화책은 금물..", "그게 뭘까?"]},
{"id" : 4, "name" : "crong", "content" : "코드스쿼드가 정말 좋은 곳일까? 믿을 수가 없다..", "like" : 0, "comment" : ["누가 그러디"]}
]
@crongro
crongro / bugcode.js
Last active January 4, 2017 05:10
bugcode
function checkargs(a,b,type) {
var checkResult;
if(typeof a !== type || typeof b !== type) return false;
else return;
}
function multiplyDouble(num2,num2) {
var DOUBLE = 2;
var sum = num1 * num2 * 2;
var result = sum * DOUBLE;
(function(count) {
var resultSet = [];
function getRandom() {
var randomNumber = Math.floor(Math.random()*count)+1;
if(resultSet.indexOf(randomNumber) === -1) {
resultSet.push(randomNumber);
if(resultSet.length < count) getRandom();
return;
}
getRandom();
@crongro
crongro / newstandmvc.js
Last active March 20, 2017 06:37
newstandmvc
var ns = {};
//utility
ns.util = {
sendAjax: function(url, fn) {
const oReq = new XMLHttpRequest();
oReq.addEventListener("load", function() {
var jsonObj = JSON.parse(oReq.responseText);
fn(jsonObj);
@crongro
crongro / a.html
Last active March 21, 2017 13:01
kakaocorp.com_html 제작중
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>카카오</title>
<link rel="stylesheet" href="main.less.css">
</head>
<body>
@crongro
crongro / es6_template_literal.js
Last active April 3, 2017 08:38
es6_template_literal
function fn(val, name, hour) {
var ampm = (hour > 11) ? "pm" : "am";
console.log(val[0], name, val[1], hour, ampm, val[2]);
}
var data = {
hour : new Date().getHours(),
name : "solvin"
}
@crongro
crongro / es6_object_enhancement.js
Last active April 1, 2017 22:23
es6_object_enhancement
const name = "nayoun";
const age = 9;
const others = {
address : "kwang myeung city",
tel : null,
height: 130
}
const data = {
name,
@crongro
crongro / es6_spread_operator.js
Created April 1, 2017 11:48
es6_spread_operator
//참조를 유지하기 때문에 이전데이터와 현재데이터는 당연히 같다.
var originData = [1,2,"foo","bar"];
var newData = originData;
console.log(originData === newData) //true
newData[0] = 3;
console.log(newData[0] === originData[0]); //true
//이전데이터와 새로운데이터간의 비교가 필요하다면, 참조를 유지하지 않고 새로운 데이터를 만들어내야 한다.
//immutable array 를 유지하는 방법.
@crongro
crongro / es6_destructuring.js
Last active April 1, 2017 22:40
es6_destructuring
var news = [
{
"title" : "sbs",
"imgurl" : "http://static.naver.net/newsstand/2017/0313/article_img/9054/173200/001.jpg",
"newslist" : [
"[가보니] 가상 경주도 즐기고, 내 손으로 자동차도 만들고",
"리캡차'가 사라진다",
"갤럭시S8' 출시? '갤노트7' 처리 계획부터 밝혀야",
"블로코-삼성SDS, 블록체인 사업 '맞손",
"[블록체인 톺아보기] 퍼블릭 블록체인의 한계와 프라이빗 블록체인"