Skip to content

Instantly share code, notes, and snippets.

View island205's full-sized avatar
🎯
Focusing

Zhi Cun island205

🎯
Focusing
View GitHub Profile
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;
@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 = '<!-- -->';
<?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 / 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',
@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,
require 'mail'
require 'gmail'
require 'base64'
gmail = Gmail.connect('[email protected]', 'password')
emailComeFromSomeone = gmail.inbox.find(:before => Date.parse("2012-10-01"), :after => Date.parse("2012-09-01"), :from => '[email protected]')
emailComeFromSomeone.each do |mail|
begin
" vundle
" git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
@island205
island205 / dream.md
Created April 22, 2013 06:23
dream

PT1ncmJlZXVobXVtNFMrbUlXK2F6RkdkekZXVFFpbzVNNmE1 PWdKcWwzNHJtakl1a0g0cG96NWltekl2dmZJdWtYVE1ucUw1RVdMNjZxTDVxaUw1 TytaNS9XWjY3Nlk1NGk0NTRpNDVtaWI1TXk3N2FtYTVRaW81MENaNVBDYjVPaUw1TXk3NzQrWTVzV1k1RXE1NXhlYjVxZUk2SnlwNUZDSTZXaW81SWliNUU2cDUyNnA1NmlMNVFpbzU=

// File: global.js
var timestamp = new Date()
exports.global = {
timestamp: timestamp
}
console.log('timestemp from global.js is ' + timestamp)
// File: foo.js
var _global = require('./global').global
var body, listener;
listener = {
handleEvent: function (evt) {
return console.log(evt.type);
}
};
body = document.body;
body.addEventListener("click", listener);
body.addEventListener("keyup", listener);