If python is misbehaving on the server, do these three things at the command line.
echo "source /opt/rh/rh-python36/enable" >> .bashrc source .bashrc python
This generates linked JavaScript, CSS, an JS files.
#!/usr/bin/python
from sys import argv
root = argv[1]
outFile = open(root + ".html", "w")
outFile.write("<!doctype html>\n")
outFile.write("<!--Author: Morrison-->\n")
outFile.write("""
<html lang="en">
<head>
<title>%s</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="%s.css"/>
<script src="%s.js">
</script>
</head>
<body>
</body>
</html>""" %(root, root, root))
outFile.close()
outFile = open(root + ".css", "w")
outFile.write("""/*Author: Morrison*/
h1, h2, .display
{
text-align:center;
}
canvas
{
border:solid 1px black;
}
""")
outFile.close()
outFile = open(root + ".js", "w")
outFile.write("/*Author: Morrison*/\n")
outFile.close();
Here is table.css
table, th, td
{
border: solid 1px black;
border-collapse: collapse;
}
table
{
margin-left:auto;
margin-right:auto;
}
th, td
{
padding:.5em;
}
th
{
background-color:#001A57;
color: white;
}
Yesterday's Problems Let's generate solutions.
Arrays
concat(array)Concatenatesarrayto this array.every(predicate)returns true if the predicate is true for every element of the array.fill(obj)fills this array with the specified objectfilter(predicate)returns a new array with all elements in this array for which the predicate evaluates totruefind(predicate)finds the first element in this array for which the predicate evaluaates totruefindIndexfinds the index of first element in this array for which the predicate evaluaates totrueforEach(f)Calls the functionffor each element of the array.includes(obj)returnstrueifobjis in this array.indexOf(obj)returns the index forobjif is in this array and -1 otherwise.map(f)returns a new array containing all thef(k)forkin this array.push(obj)appendsobjto this array and return the array's new size.pop()removes the last element of the array and returns it.shiftremoves the first element of the array and returns it.unshift(obj)Insertsobjat the beginning of this array.sort(comp)If no argument is passed, it sorts the elements in the array asciicographically, using their string representations. Pass the comparator(a, b) => a - bto sort a numerical array.
Nodes and Nodelists A node is an element on
a web page. The function document.getElementById()
returns a node. Nodes are als called HTMLElements.
Objects
Primitive vs. Object Let's generate solutions.
Classes