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 {number} value 輸入 | |
* @param {number} position 小數點第 N 位 | |
*/ | |
function zeroDisplay (value, position = 2) { | |
let number = value * 1 | |
return isNaN(number) ? 0 : parseFloat(number.toFixed(position)) | |
} |
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
/** | |
* 取小數點第 N 位 | |
* @summary 末位四捨五入 | |
* @param {number} value 輸入 | |
* @param {number} position 小數點第 N 位 | |
*/ | |
function toPointFixed (value, position) { | |
const decimalType = 10 | |
let decimalNumber = Math.pow(decimalType, position) | |
return Math.round(value * decimalNumber) / decimalNumber |
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
import Radio from './Radio' | |
import Gropu from './Group' | |
Radio.Gropu = Gropu | |
Radio.install = function(Vue) { | |
Vue.component(Radio.name, Radio | |
Vue.component(Radio.Group.name, Radio.Group) | |
} |
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
const deepFlatten = arr => [].concat(...arr.map(v => (Array.isArray(v) ? deepFlatten(v) : v))); | |
// deepFlatten([1, [2], [[3], 4], 5]); // [1,2,3,4,5] |
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
/** | |
* iscroll 被動事件偵聽器以提升滾動性能(ie not support) | |
* source code : https://github.com/cubiq/iscroll/blob/master/demos/demoUtils.js | |
* MDN : https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener#option%E6%94%AF%E6%8C%81%E7%9A%84%E5%AE%89%E5%85%A8%E6%A3%80%E6%B5%8B | |
* passive google article : https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners?hl=zh-tw | |
*/ | |
function isPassive () { | |
var passiveSupported = false | |
try { |
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
// 1554863406354 to Wed Apr 10 2019 10:29:26 GMT+0800 (台北標準時間) | |
function toUTC (value) { | |
var date = new Date() | |
if (value) { | |
date = new Date(value) | |
} | |
var nowUtc = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), | |
date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()) | |
return nowUtc |
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
git 教 | |
- https://github.com/mylxsw/growing-up/blob/master/doc/%E7%A0%94%E5%8F%91%E5%9B%A2%E9%98%9FGIT%E5%BC%80%E5%8F%91%E6%B5%81%E7%A8%8B%E6%96%B0%E4%BA%BA%E5%AD%A6%E4%B9%A0%E6%8C%87%E5%8D%97.md | |
- https://kingofamani.gitbooks.io/git-teach/content/chapter_3_branch/git.html | |
C# https://docs.microsoft.com/zh-tw/dotnet/csharp/language-reference/keywords/enum | |
canvas flash 分層 - https://www.ibm.com/developerworks/cn/web/wa-canvashtml5layering/index.html | |
UIUX class - https://xue.uisdc.com/ixd/ |
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 isMobile() { | |
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { | |
retrun true | |
} else { | |
return false | |
} | |
} |
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 toPointFixed(value, position) { | |
const decimalType = 10; | |
let decimalNumber = Math.pow(decimalType, position) | |
return Math.floor(value * decimalNumber) / decimalNumber | |
} |
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
/* cssTable */ | |
.c-cssTable | |
display: table | |
+has(thead) | |
display: table-header-group | |
+has(tbody) | |
display: table-row-group |
NewerOlder