View 0_reuse_code.js
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View gist:14213922b9127c8442b5b53f5345b647
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 fs = require('fs'); | |
let population = JSON.parse(fs.readFileSync('population.json','utf8')); | |
population = population.filter(c => c.Year == "2016"); | |
population = population.map(c=> {return {code3:c['Country Code'],population:c.Value}}); | |
population = population.filter(c => c != null); | |
let country3to2 = JSON.parse(fs.readFileSync('3to2countrycode.json','utf8')); | |
population = population.filter(c => c != null); | |
population = population.map(c=> { |
View server.js
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 http = require("http"); | |
const express = require("express"); | |
const app = express(); | |
app.set('view engine', 'ejs'); | |
const port = 5000; ; | |
app.get("/",(req,res)=> { | |
res.end("Hello world"); | |
}); |
View companies.js
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 companies = [ | |
'AAPL', | |
'MSFT', | |
'AMZN', | |
'GOOGL', | |
'FB', | |
'BRK.A', | |
'BABA' | |
//'SEHK: 700' // wechat's tencent | |
'JPM', |
View gist:ecc57e6aefa0e9f46d746da27de2c91d
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
<html> | |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.11.2"></script> | |
</head> | |
<body> | |
<div id="output_field"></div> | |
</body> | |
<script> | |
async function learnLinear() { | |
const model = tf.sequential(); |