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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Speech Recording</title> | |
</head> | |
<body> | |
<script> |
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
class MyTodos extends HTMLElement { | |
constructor() { | |
// always call super() first in your constructor to inherit from your parent class | |
super(); | |
} | |
} | |
// register new tag and associate it with the class | |
customElements.define('my-todos', MyTodos); |
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
class MyTodos extends HTMLElement { | |
// called when the HTML parser sees the HTML tag | |
constructor () { | |
// always call super() first in your constructor to inherit from your parent class | |
super(); | |
this.title = 'My todos'; | |
} | |
// called when the element is inserted in the DOM | |
// immediately after constructor if the element is in the DOM already |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>My todos</title> | |
</head> | |
<body> | |
<my-todos></my-todos> |
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
<body> | |
<google-mail> | |
<mail-header></mail-header> | |
<mail-navigation></mail-navigation> | |
<mail-list> | |
<mail-thread id="74738ff5-5367-5958-9aee-98fffdcd1876"> | |
<mail-content from="[email protected]" to="[email protected]"> | |
<h2>Hi Jane</h2> | |
<article> | |
<p>...</p> |
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
class MyTodos extends HTMLElement { | |
// called when the HTML parser sees the HTML tag | |
constructor () { | |
// always call super() first in your constructor to inherit from your parent class | |
super(); | |
this.title = 'My todos'; | |
} | |
// called when the element is inserted in the DOM | |
// immediately after constructor if the element is in the DOM already |
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 getContrast50(hex){ | |
return (parseInt(hex, 16) > 0xffffff/2) ? 'black': 'white'; | |
} |
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 getContrastYIQ(hexcolor){ | |
var r = parseInt(hexcolor.substr(0, 2), 16); | |
var g = parseInt(hexcolor.substr(2, 2), 16); | |
var b = parseInt(hexcolor.substr(4, 2), 16); | |
var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; | |
return (yiq >= 128) ? 'black' : 'white'; | |
} |
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
[ | |
{ "input": { "r": "0.00", "g": "0.00", "b": "0.00" }, "output": { "white": 1 } }, | |
{ "input": { "r": "0.85", "g": "0.88", "b": "0.56" }, "output": { "black": 1 } }, | |
{ "input": { "r": "0.33", "g": "0.35", "b": "0.84" }, "output": { "white": 1 } }, | |
{ "input": { "r": "0.00", "g": "0.99", "b": "1.00" }, "output": { "black": 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
'use strict' | |
const brain = require('brain.js'); | |
const data = require('./training-data.json'); | |
const network = new brain.NeuralNetwork(); | |
network.train(data, { log: true }); | |
const result = network.run({ r: 0, g: 1, b: 0.65 }); |
OlderNewer