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
getRandomString(length = 8) { | |
// 生成する文字列に含める文字セット | |
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
let r = ""; | |
for(let i = 0, charsLength = chars.length; i < charsLength; i++){ | |
r += chars[Math.floor(Math.random()*cl)]; | |
} | |
return r; | |
} |
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 setupFixedBg() { | |
const $fixed = $('.js-fixed-bg'); | |
const $wrapper = isSP() ? $(window) : $('.wrapper'); | |
let _tmpTop = $wrapper.scrollTop(); | |
(function _update() { | |
const top = $wrapper.scrollTop(); | |
if(top !== _tmpTop) { | |
$fixed.css('transform', `translateY(${top}px)`); | |
} | |
_tmpTop = top; |
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
ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ー |
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
/** | |
* 数字に漢字の桁を付ける | |
* ex: 1234567890123 => 1兆2345億6789万123 | |
* @param {String | Number} num 数字 | |
* @return {String} 漢字付きの数字 | |
*/ | |
export default function num2ja(num) { | |
const keta = ['', '千', '万', '億', '兆'] | |
let jaNum = '' |
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
/** | |
* rootからtargetのスクロール量を計算する | |
*/ | |
export default function calcOffsetTop(target: HTMLElement, root: HTMLElement = document.body) { | |
if(!target) throw new Error('[no target]'); | |
let elm: HTMLElement = target | |
let offset: number = 0 | |
while(true) { |
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
cat ./tmp/pids/server.pid | xargs kill -9 |
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 hira2kata(str) { | |
return str.replace(/[\u3041-\u3096]/g, (match) => { | |
const chr = match.charCodeAt(0) + 0x60; | |
return String.fromCharCode(chr); | |
}) | |
} |
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
import _ from "lodash" | |
/** | |
* 1000.234 => 0010,000.234 | |
* @param val 元の値 | |
* @param payload | |
* @param keta ゼロ字詰する桁数 | |
* @param fixed 小数点以下の表示桁数 | |
*/ | |
export default (val, { keta = 0, fixed = 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
class QueryString { | |
parse(search) { | |
let obj = {} | |
search = search.replace(/^\?/, "") | |
const pairs = search.split("&") | |
pairs.forEach(pair => { | |
const [key, val] = pair.split("=") | |
obj[key] = val | |
}) |