View googlemaps-like-pin.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Google Maps like Pin</title> | |
<link type="text/css" rel="stylesheet" href="pin.css" /> | |
</head> | |
<body> | |
View oop.js
function extend(Child, Parent) { | |
Child.prototype = Object.create(Parent.prototype); | |
Child.prototype.constructor = Child; | |
return Child; | |
} | |
var Message = function (text) { | |
this.text = text; | |
}; |
View to_array.js
function toArray(args) { | |
return Array.prototype.slice.call(args); | |
} |
View uniq_id.js
var uniqID = (function () { | |
var _uniq = new Date().getTime(); | |
return function () { | |
return (_uniq++).toString(36); | |
}; | |
})() |
View memoize.js
function memoize(fn) { | |
var slice = Array.prototype.slice, | |
cache = []; | |
return function () { | |
var args = slice.call(arguments), | |
result = cache[args]; | |
if (!result) { | |
result = cache[args] = fn.apply(this, args); | |
} |
View xhr_promise.js
function get(url) { | |
return new Promise(function(resolve, reject) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url); | |
xhr.onload = function() { | |
if (xhr.status === 200) { | |
resolve(xhr.response); | |
} else { | |
reject(Error(xhr.statusText)); |
View chart.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width" /> | |
<link rel="stylesheet" type="text/css" href="main.css" /> | |
<title>CSS Chart</title> | |
</head> | |
<body> | |
<div class="bars-wrapper"> |
View text-overflow.css
.text-overflowed { | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
} |
View defer.js
function defer(fn) { return setTimeout(fn, 0); } |
View insert.js
function insert(item, index, array) { | |
array.splice(index, 0, item); | |
return array; | |
} |
OlderNewer