Skip to content

Instantly share code, notes, and snippets.

View leafbird's full-sized avatar

choi sung ki leafbird

View GitHub Profile
function asyncMap( list, fn, cb_ ) {
var n = list.length
, result = []
, errState = null;
function cb (er, data) {
if (errState) return;
if (er) return cb_(errState = er);
results.push(data);
if (--n === 0) // 모든 리스트 처리 완료시
@leafbird
leafbird / default.html
Last active December 15, 2015 20:29
html 파일 만들 때 기본으로 타이핑하는 마크업들.
<!doctype html>
<html>
<head>
<title>Write Title Here.</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link class="include" rel="stylesheet" type="text/css" href="style.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
@leafbird
leafbird / formatting.js
Created April 1, 2013 05:04
string formatting function in JavaScript.
String.prototype.format = function () {
var formatted = this;
for (arg in arguments) {
formatted = formatted.replace("{" + arg + "}", arguments[arg]);
}
return formatted;
};