This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@keyframes typing{from { width: 0; } } | |
@-webkit-keyframes typing{from { width: 0; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
OlderNewer