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)
Concatenatesarray
to 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 totrue
find(predicate)
finds the first element in this array for which the predicate evaluaates totrue
findIndex
finds the index of first element in this array for which the predicate evaluaates totrue
forEach(f)
Calls the functionf
for each element of the array.includes(obj)
returnstrue
ifobj
is in this array.indexOf(obj)
returns the index forobj
if is in this array and -1 otherwise.map(f)
returns a new array containing all thef(k)
fork
in this array.push(obj)
appendsobj
to this array and return the array's new size.pop()
removes the last element of the array and returns it.shift
removes the first element of the array and returns it.unshift(obj)
Insertsobj
at 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 - b
to 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 HTMLElement
s.
Objects
Primitive vs. Object Let's generate solutions.
Classes