Skip to content

Instantly share code, notes, and snippets.

View island205's full-sized avatar
🎯
Focusing

Zhi Cun island205

🎯
Focusing
View GitHub Profile
@island205
island205 / parseURL.js
Last active December 19, 2015 05:49
parseURL
/**
http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
*/
function parseURL(url) {
var a = document.createElement('a');
a.href = url;
return {
source: url,
protocol: a.protocol.replace(':',''),
host: a.hostname,
@island205
island205 / this context in koa.js
Created May 5, 2014 14:50
this context in koa.js
{
request: {
method: 'POST',
url: '/api/forums',
header: {
host: 'localhost:3000',
connection: 'keep-alive',
'content-length': '77',
'cache-control': 'no-cache',
origin: 'chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop',
<?xml version="1.0" encoding="UTF-8" ?>
<opml version="1.0">
<head>
<title>寸志 subscriptions in Digg Reader</title>
</head>
<body>
<outline text="Framer Blog" title="Framer Blog" type="rss" xmlUrl="http://framerjs.tumblr.com/rss" htmlUrl="http://framerjs.tumblr.com/" />
<outline text="粉丝日志" title="粉丝日志" type="rss" xmlUrl="http://blog.fens.me/feed/" htmlUrl="http://blog.fens.me" />
<outline text="AngularJS" title="AngularJS" type="rss" xmlUrl="http://blog.angularjs.org/feeds/posts/default" htmlUrl="http://blog.angularjs.org/" />
<outline text="blog.izs.me" title="blog.izs.me" type="rss" xmlUrl="http://blog.izs.me/rss" htmlUrl="http://blog.izs.me/" />
@island205
island205 / stripCommentTag.js
Last active August 29, 2015 14:06
stripCommentTag
var STRIP_COMMENT_TAG_REGEXP, end, start, stripCommentTag, testStringA, testStringB;
STRIP_COMMENT_TAG_REGEXP = /<!--(.|\s)*?-->/gm;
stripCommentTag = function(html) {
return html.replace(STRIP_COMMENT_TAG_REGEXP, "");
};
testStringA = '<!-- -->';
window.requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) {
window.setTimeout(a, 1000 / 60)
}
})();
window.onload = function() {
var m = canvas.getContext("2d"),
k, g;
canvas.width = k = window.innerWidth * 2.1;
canvas.height = g = window.innerHeight * 1.4;