This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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); |
This file contains hidden or 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 url = require('url'); | |
var options = { | |
publicPath: '/test' | |
}; | |
var compiler = { | |
outputPath: '/' | |
}; | |
function pathJoin(a, b) { | |
return a == "/" ? "/" + b : (a||"") + "/" + b; |
This file contains hidden or 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 (doc, win) { | |
var docEl = doc.documentElement, | |
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | |
recalc = function () { | |
var clientWidth = docEl.clientWidth; | |
if (!clientWidth) return; | |
docEl.style.fontSize = 36 * (clientWidth / 320) + 'px'; | |
}; | |
if (!doc.addEventListener) return; | |
win.addEventListener(resizeEvt, recalc, false); |
This file contains hidden or 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
// Brainfuck. | |
// | |
// codewars: https://www.codewars.com/kata/my-smallest-code-interpreter-aka-brainf-star-star-k/train/javascript | |
// brainfuck debug tool: http://www.iamcal.com/misc/bf_debug/ | |
// brainfuck on wikipedia: https://zh.wikipedia.org/wiki/Brainfuck | |
function brainLuck(code, input){ | |
let codeInArray = code.split(''); | |
let inputInArray = input.split(''); | |
console.log(code); |
This file contains hidden or 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
#!/bin/bash | |
# Request Github Api | |
# | |
# Usage: | |
# shells/request.sh <GET|POST> <api> [params] | |
# | |
# Sample: | |
# ./shells/request.sh POST merges \ | |
# "{\"base\":\"master\",\"head\":\"develop\",\"commit_message\":\"$message\"}" |