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
$ # 任意の <PREFIX> から始まるブランチを一括削除する | |
$ git branch | grep -E 'PREFIX.' | xargs -I % git branch -d % |
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
$ # master と develop を除く merge 済みのブランチを一括削除する | |
$ git branch --merged master | grep -vE '^\*|master$|develop$' | xargs -I % git branch -d % |
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
precision mediump float; | |
uniform sampler2D textureUnit; | |
uniform vec2 invResolution; // 1.0 / resolution | |
const float REDUCE_MIN = 1.0 / 128.0; | |
const float REDUCE_MUL = 1.0 / 8.0; | |
const float SPAN_MAX = 8.0; | |
const vec3 LUMA = vec3(0.299, 0.587, 0.114); |
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
/** | |
* @param {vec2} coord - base texture coord | |
* @param {vec2} view - resolution of viewport | |
* @param {vec2} resource - resolution of resource | |
* @return {vec2} like a `background-size: cover` on css | |
*/ | |
vec2 cover(vec2 coord, vec2 view, vec2 resource){ | |
vec2 ratio = vec2( | |
min((view.x / view.y) / (resource.x / resource.y), 1.0), | |
min((view.y / view.x) / (resource.y / resource.x), 1.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
function uuid(){ | |
// https://github.com/GoogleChrome/chrome-platform-analytics/blob/master/src/internal/identifier.js | |
const chars = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.split(''); | |
for(let i = 0, j = chars.length; i < j; i++){ | |
switch(chars[i]){ | |
case 'x': | |
chars[i] = Math.floor(Math.random() * 16).toString(16); | |
break; | |
case 'y': | |
chars[i] = (Math.floor(Math.random() * 4) + 8).toString(16); |
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
copyToClipboard(str){ | |
const t = document.createElement('textarea'); | |
t.value = str; | |
document.body.appendChild(t); | |
t.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(t); | |
} |
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
let isMobileDevice = ( | |
ua.indexOf('android') > -1 || | |
ua.indexOf('iphone') > -1 || | |
ua.indexOf('ipod') > -1 || | |
ua.indexOf('ipad') > -1 || | |
(ua.indexOf('macintosh') > -1 && 'ontouchend' in document) | |
); |
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 powerOfTwo(v){ | |
return (v & (v - 1)) === 0; | |
} | |
function nearPowerOfTwo(v){ | |
if(v <= 0){return 0;} | |
let w = v; | |
w = w | (w >> 1); | |
w = w | (w >> 2); | |
w = w | (w >> 4); | |
w = w | (w >> 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 copyToClipboard(stringData){ | |
let t = document.createElement('textarea'); | |
t.value = stringData; | |
document.body.appendChild(t); | |
t.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(t); | |
} |
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
let t = document.createElement('textarea'); | |
t.value = 'hogepiyo'; | |
document.body.appendChild(t); | |
t.select(); | |
document.execCommand('copy'); | |
document.body.removeChild(t); |
NewerOlder