鐵人賽 Day 23 - 站直、抬起頭 / 善待自己,就像善待任何你有責任幫助的人
Tags: 12-rules-for-life, 2020-12th-ironman, 鐵人賽
站直、抬起頭
Stand up straight with your shoulders back
- 像隻龍蝦! 永遠抬頭挺胸!
- 跟 Your body language may shape who you are 一樣!
善待自己,就像善待任何你有責任幫助的人
Treat yourself like someone you are responsible for helping
- 跟自己說言行一致,對所有人看所以事物都要用平常心來處理 :)
- 和韓第爺爺說得一樣,你像樣怎麼被對待就怎麼樣對待別人。
碼農小園地
-
看用的是什麼 browser
-
Navigator
- The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.
-
Navigator
function () {
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE ' + (tem[1] || '');
}
if (M[1] === 'Chrome') {
tem = ua.match(/\b(OPR|Edge?)\/(\d+)/);
if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');
}
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]);
return M.join(' ');
};
// this code snippet splits a string in a special notation
if (navigator.userAgent.indexOf("Chrome") !== -1) {
// YES! The user is suspected to support look-behind regexps
// DO NOT USE /(?<=[A-Z])/. It will cause a syntax error in
// browsers that do not support look-behind expressions
// because all browsers parse the entire script, including
// sections of the code that are never executed.
var camelCaseExpression = new RegExp("(?<=[A-Z])");
var splitUpString = function (str) {
return ("" + str).split(camelCaseExpression);
};
} else {
/*This fallback code is much less performant, but works*/
var splitUpString = function (str) {
return str.replace(/[A-Z]/g, "z$1").split(/z(?=[A-Z])/g);
};
}
console.log(splitUpString("fooBare")); // ["fooB", "are"]
console.log(splitUpString("jQWhy")); // ["jQ", "W", "hy"]