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
// Require Underscore.js | |
Percentage = function(numbers) { | |
var percentage = [], | |
sum = _.reduce(numbers, function(m, number){ return m + number; }, 0); | |
for(var n = 0; n < numbers.length; n++){ | |
percentage[n] = parseFloat((numbers[n]/sum * 100).toFixed(3)); | |
percentage[n] = Math.round(percentage[n] * 10)/10; | |
}; |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
{ | |
"extends": [ | |
"eslint:recommended", | |
"plugin:react/recommended" | |
], | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"jest": true | |
}, |
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
{ | |
"bracketSpacing": true, | |
"jsxBracketSameLine": true, | |
"singleQuote": true, | |
"semi": true, | |
"trailingComma": "none", | |
"tabWidth": 2 | |
} |
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
{ | |
"rules": { | |
"color-hex-case": "lower", | |
"block-no-empty": true, | |
"number-leading-zero": "never", | |
"declaration-colon-space-after": "always", | |
"declaration-colon-space-before": "never", | |
"color-hex-length": "short", | |
"indentation": 2, | |
"string-quotes": "double", |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8"> | |
<meta content="width=device-width, initial-scale=1" name="viewport"> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" rel="stylesheet" | |
type="text/css" /> | |
<link href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"> | |
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> |
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 response = { | |
"data": { | |
"query": "What is javascript ?", | |
"answer" : { | |
"value": "JavaScript is 💛" | |
} | |
} | |
} |
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
let theValue; | |
if(response && | |
response.data && | |
response.data.answer && | |
response.data.answer.value) { | |
theValue = response.data.answer.value; | |
} else { | |
theValue = 'JavaScript is BAE 💛❤️'; | |
} |
OlderNewer