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 square(a) { | |
return a*a; | |
} | |
function squareMaxElements (a,b,c) { | |
var min = Math.min(a,b,c) | |
, arr = [a,b,c] | |
; | |
return arr = arr.filter(function (element) { |
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 arr = [1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10] | |
, i | |
, sum | |
; | |
console.time("while"); | |
i = arr.length; | |
sum = 0; | |
while (i--) |
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 countClasses(array) { | |
var object = {} | |
; | |
array.forEach(function(element) { | |
if (object[element]) { | |
object[element]++; | |
} | |
else { | |
object[element] = 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
let name = event.target['organisation-name'].value.trim(); | |
let description = event.target['organisation-description'].value.trim(); | |
let companySite = event.target['company-site'].value.trim(); | |
let iconUrl = template.iconUrl.get(); |
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/bash | |
# Functions ============================================== | |
# return 1 if global command line program installed, else 0 | |
# example | |
# echo "node: $(program_is_installed node)" | |
function program_is_installed { | |
# set to 1 initially | |
local return_=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
{ | |
"extends": ["eslint:recommended", "plugin:react/recommended"], | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"node": true | |
}, | |
"plugins": [ | |
"react" | |
], |
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
x | y | value | |
---|---|---|---|
France | Apricot | 2.3129545439964723 | |
France | Avocado | 3.1610140317890965 | |
France | Lemon | 0.9075695440623942 | |
France | Date | 1.1296454803177811 | |
France | Strawberry | ||
France | Mandarin | 2.6193568568512493 | |
France | Chestnut | 0.08748279136251946 | |
France | Nuts | 2.943858242639327 | |
France | Olive | 1.3356914547843943 |
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
State | Under 5 Years | 5 to 13 Years | 14 to 17 Years | 18 to 24 Years | 25 to 44 Years | 45 to 64 Years | 65 Years and Over | |
---|---|---|---|---|---|---|---|---|
CA | 2704659 | 4499890 | 2159981 | 3853788 | 10604510 | 8819342 | 4114496 | |
TX | 2027307 | 3277946 | 1420518 | 2454721 | 7017731 | 5656528 | 2472223 | |
NY | 1208495 | 2141490 | 1058031 | 1999120 | 5355235 | 5120254 | 2607672 | |
FL | 1140516 | 1938695 | 925060 | 1607297 | 4782119 | 4746856 | 3187797 | |
IL | 894368 | 1558919 | 725973 | 1311479 | 3596343 | 3239173 | 1575308 | |
PA | 737462 | 1345341 | 679201 | 1203944 | 3157759 | 3414001 | 1910571 |
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 obj = { | |
translationX: -10, // translation for label to move it a bit left | |
barTranslationX: 7, // translation for bar to move it a bit right | |
coefficientTranslationYForLeastValuable: 10, | |
coefficientTranslationY: 26, // translation for label to move it right down in a row with 0 valuable scores | |
getYTranslation: function(value) {console.log(this, value); | |
return value === 0.1 ? this.coefficientTranslationYForLeastValuable : value * this.coefficientTranslationY + 2 * value + 7} | |
}; | |
export default obj; |
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 unique = 'ab'; | |
var all = 'Aaabbb'; | |
var uniqueArr = unique.split(''); | |
var allArr = all.split(''); | |
function converToObj(accum, currentEl) { | |
if (!accum[currentEl]) accum[currentEl] = true; | |
return accum; |