Skip to content

Instantly share code, notes, and snippets.

View ijse's full-sized avatar
🎯
Focusing

Li Yi ijse

🎯
Focusing
View GitHub Profile
@ijse
ijse / Notification.js
Created December 1, 2011 08:31
Plugin for Notification of html5 with Chrome
/**
* Notification
* @author: ijse
* @require: Chrome10+
* @params: Same as webkitNotifications.create[HTML]Notification()
* @usage:
* new Notify("http://www.baidu.com").onshow(function() {
* alert("show");
* }).onclose(function() {
* alert("close");
@ijse
ijse / jsextend.js
Created May 25, 2012 03:02
JS:extend function based on Prototype
/**
* Function Extend based on Prototype
* @author ijse
*/
exports.extend = function(sub, superclass) {
var F = function() {};
F.prototype = superclass.prototype;
sub.prototype = new F();
sub.prototype.constructor = sub;
sub.superclass = superclass.prototype;
@ijse
ijse / jQuery.extend.js
Created May 6, 2013 06:00
Object.extend() implement from jQuery
{
//Object.extend comes from jQuery
extend: function () {
var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false,
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
@ijse
ijse / directory.js
Last active December 17, 2015 02:49 — forked from danherbert-epam/directory.js
mkdir -p 支持多平台
var fs = require('fs');
var pathSep = require('path').sep;
var Path = require("path");
var directory = module.exports = {};
directory.mkdirSync = function __directory_mkdirSync__(path) {
var dirs = Path.normalize(path).split(pathSep);
var root = "";
@ijse
ijse / newsApiResult.js
Created June 3, 2013 05:02
新闻接口返回数据格式
cyouCallback([
{
"url": "/ty/media/20130415/55113.shtml",
"date": "2013-04-15",
"title": "【优酷】超燃!玩家激情解说桃园竞技场",
"channel":"媒体"
},
{
"url": "/ty/media/20130415/55112.shtml",
"date": "2013-04-15",
@ijse
ijse / fileUtil.js
Created November 6, 2013 08:26
Folder utils offen use
var fs = require('fs');
var pathSep = require('path').sep;
var Path = require("path");
var directory = module.exports = {};
directory.mkdirSync = function __directory_mkdirSync__(path) {
var dirs = Path.normalize(path).split(pathSep);
var root = "";
@ijse
ijse / dataURItoBlob.js
Created November 14, 2013 08:52
Very useful for resizing images before upload using html5 canvas.
/**
* Convert base64 encode image into Blob
*
* Usage:
* var dataURL = canvas.toDataURL('image/jpeg', 0.5);
* var blob = dataURItoBlob(dataURL);
* var fd = new FormData(document.forms[0]);
* fd.append("canvasImage", blob);
*
* See: http://stackoverflow.com/a/5100158/1063090
@ijse
ijse / tiny_template_engine.js
Created September 3, 2014 02:56
tiny template engine
// template helper
function tpl(t, d) {
var s = t;
if (!d) return s;
for (k in d) {
s = s.replace(new RegExp('\\${' + k + '}', 'g'), d[k]);
}
return s;
};
@ijse
ijse / adaptUILayout.js
Created September 16, 2014 07:49
adaptUILayout
/*
* 使用说明:
* 本程序以完成固定宽度布局的网页在iPhone/Android设备上浏览时可以适配设备屏幕宽度(竖屏浏览, 暂未支持横屏浏览)
* 为目的。正常运行的环境是: iPhone/Android设备的自带浏览器.
* 如有问题,意见或建议,请到我的博客页面留言,或发送邮件.
* 其他移动版浏览器的适配问题, 不在本程序处理范围, 若有相关问题, 请留言或发送邮件.
*
* 博客页面地址:
* http://www.cnblogs.com/plums/archive/2013/01/10/WebApp-fixed-width-layout-of-multi-terminal-adapter-since.html
* 邮箱: limuchen12@126.com
@ijse
ijse / dabblet.css
Created October 8, 2014 05:24 — forked from kejun/dabblet.css
Untitled
p:nth-child(1) {
font-size: 12px;
margin: 20px;
width: 200px;
height: 150px;
-webkit-hyphens: auto;
-webkit-shape-inside: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
overflow: hidden;
}