Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
function exFunc(arg: number, { | |
a = 0, | |
b = 'func' | |
}: { | |
a?: number, | |
b?: string | |
} = {}) { | |
// funk! | |
} |
const FileType = { | |
File: 'file', | |
Directory: 'directory', | |
Unknown: 'unknown', | |
} | |
/** | |
* ファイルの種類を取得する | |
* @param {string} path パス | |
* @return {FileType} ファイルの種類 |
const SetVar = ({propertyName, value, el, pre = 'my'}) => { | |
if (!el) { | |
document.documentElement.style.setProperty(`--${pre}-${propertyName}`, value) | |
} else { | |
el.style.setProperty(`--${pre}-${propertyName}`, value) | |
} | |
} | |
export default SetVar |
const Clipboard = (text) => { | |
let textarea = document.createElement('textarea') | |
textarea.value = text | |
textarea.className = 'js-clip' | |
document.body.appendChild(textarea) | |
textarea.focus() | |
textarea.select() | |
document.execCommand('copy') |
export class Vector2d { | |
constructor(x = 0, y = 0) { | |
this.x = x | |
this.y = y | |
} | |
// return the angle of the vector in radians | |
getDirection() { | |
return Math.atan2(this.y, this.x) | |
} |
const getter = Object.getOwnPropertyDescriptor( | |
HTMLElement.prototype, | |
'classList', | |
).get | |
// Add to classList SVGElement getter | |
Object.defineProperty(SVGElement.prototype, 'classList', { | |
get: getter, | |
}) |
const video = document.createElement('video') | |
const checkVideoType = () => { | |
if (video.canPlayType('video/webm') === 'maybe') { | |
return 'webm' | |
} else if (video.canPlayType('video/mp4') === 'maybe') { | |
return 'mp4' | |
} else { | |
return null | |
} |
navigator.serviceWorker.getRegistrations().then(function(registrations) { | |
for(let registration of registrations) { | |
registration.unregister(); | |
} | |
}); | |
caches.keys().then(function(keys) { | |
var promises = []; | |
keys.forEach(function(cacheName) { | |
if (cacheName) { | |
promises.push(caches.delete(cacheName)); |
function scrollControl(event) { | |
event.preventDefault() | |
} | |
function noScroll() { | |
document.addEventListener('mousewheel', scroll_control, { passive: false }) | |
document.addEventListener('touchmove', scroll_control, { passive: false }) | |
} | |
function returnScroll() { |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |