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
CURRENCY_MAP = { | |
'$': 'USD', | |
'₽': 'RUB', // there is a missing character in editor font | |
'€': 'EUR', | |
'฿': 'THB' | |
} | |
function _formatToCurrency(formatString) { | |
var currencyRegexp = /\[.*(.)\]/g; | |
var currency = currencyRegexp.exec(formatString)[1]; |
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
quickSort = ([x, ...xs]) => { | |
if (typeof(x) === 'undefined') return []; | |
return [ | |
...quickSort(xs.filter(y => y <= x)), | |
x, | |
...quickSort(xs.filter(y => y > x)) | |
]; | |
} |
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
#!/bin/sh | |
set -e | |
set -x | |
mas upgrade && | |
brew update && | |
brew upgrade && | |
npm-check -u -g && | |
apm upgrade -c=false |
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
var vm = new Vue({ | |
el: '#demo', | |
data: { | |
firstName: 'Foo', | |
lastName: 'Bar' | |
}, | |
computed: { | |
fullName: function () { | |
return this.firstName + ' ' + this.lastName | |
} |
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
<div class="container"> | |
<header> | |
<slot name="header"></slot> | |
</header> | |
<main> | |
<slot></slot> | |
</main> | |
<footer> | |
<slot name="footer"></slot> | |
</footer> |
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
const Price = (props) => { | |
const price = props.children.toLocaleString('en', { | |
style: props.showSymbol ? 'currency' : undefined, | |
currency: props.showSymbol ? 'USD' : undefined, | |
maximumFractionDigits: props.showDecimals ? 2 : 0, | |
}); | |
return <span className={props.className}>{price}</span> | |
}; |
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
const capitalizeExeptions = ['dc'] | |
export const capitalizeCityName = string => { | |
if (!string) return '' | |
string = string.toLowerCase() | |
if (string.includes(' ')) { | |
return string | |
.split(' ') | |
.reduce((result, word) => `${result && `${result} `}${capitalizeCityName(word)}`, '') | |
} | |
if (capitalizeExeptions.includes(string)) { |
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
{ | |
id: 1, | |
created_by: { | |
id: 2, | |
firstname: "Artur", | |
lastname: "Kornakov", | |
username: null | |
}, | |
updated_by: { | |
id: 2, |
OlderNewer