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 / gist:9362b096c4242fac85ac
Created June 4, 2015 07:04
convert dataUrl to blog
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {type:mime});
}
@ijse
ijse / gist:e67214dea1d618a4ef07
Created June 4, 2015 06:31
convert base64 image to file object
var img_b64 = lcvs.toDataURL('image/png');
var png = img_b64.split(',')[1];
var the_file = new Blob([window.atob(png)], {type: 'image/png', encoding: 'utf-8'});
@ijse
ijse / css3-typing-animation (1).css
Created December 23, 2014 09:58
css3-typing-animation
@keyframes typing{from { width: 0; } }
@-webkit-keyframes typing{from { width: 0; } }
@ijse
ijse / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ijse
ijse / dabblet.css
Created October 8, 2014 05:25
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@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;
}
@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 / 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 / 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 / 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 = "";