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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / 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;
var isMobile = false;
$editor.on('click', '.comment-bar', function(event) {
if(isMobile) return null;
handleBarClick(event);
});
$editor.on('touchstart', '.comment-bar', function(event) {
isMobile = true;
handleBarClick(event);