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 / 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});
}
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);
@ijse
ijse / file.js
Last active March 29, 2016 02:34
webpack-dev-middleware getFilenameFromUrl compare
var url = require('url');
var options = {
publicPath: '/test'
};
var compiler = {
outputPath: '/'
};
function pathJoin(a, b) {
return a == "/" ? "/" + b : (a||"") + "/" + b;
@ijse
ijse / dynamic-viewport.js
Created August 10, 2016 07:15
dynamic set html font-size
(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);
@ijse
ijse / brainfuck-at-codewars.js
Created September 14, 2016 11:58
brainfuck
// 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);
#!/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\"}"