Skip to content

Instantly share code, notes, and snippets.

View smessing's full-sized avatar

Samuel Messing smessing

  • Google, Inc.
  • New York
View GitHub Profile
@smessing
smessing / table_color.css
Last active December 14, 2015 09:39
A broken example for use in the DTSE lecture on JavaScript. Here the script runs before the HTML document loads!
body {
font-family: 'Arial';
font-size: 46px;
text-align: center;
}
.centered {
margin: 0 auto;
padding-top: 60px;
width: 600px;
@smessing
smessing / table_color_broken.html
Last active December 14, 2015 09:39
A broken example for use in the DTSE lecture on JavaScript. Here the script runs before the HTML document loads!
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="table_color.css">
<script src="table_color_broken.js"></script>
</head>
<body>
<div class="centered">
<table>
<tr>
body {
font-family: 'Arial';
font-size: 46px;
text-align: center;
}
.centered {
margin: 0 auto;
padding-top: 60px;
width: 600px;
@smessing
smessing / table_color.css
Last active December 14, 2015 09:09
A working example for the DTSE JavaScript lecture. The HTML document defines a 5 x 5 table. The JS code iterates row-by-row, changing the color of each cell in turn.
body {
font-family: 'Arial';
font-size: 46px;
text-align: center;
}
.centered {
margin: 0 auto;
padding-top: 60px;
width: 600px;
var main = function() {
var color_tile = function(i, j, delay) {
/* Create the id string for this table cell. */
var cell_id = String(i) + "-" + String(j);
/* Get the html cell element using the cell_id variable. */
var cell_element = document.getElementById(cell_id);
/* Print which cell the function is working on, for debugging
* purposes. In chrome open View->Developer->JavaScript Console
* to see the output. */
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="table_color.css">
<script src="table_color.js"></script>
</head>
<body onload="color_tiles()">
<div class="centered">
<table>
<tr>
@smessing
smessing / sandbox.html
Last active December 14, 2015 08:38
Sandbox HTML, use this to test out JavaScript.
<!DOCTYPE html>
<html>
<body>
<script src="sandbox.js"></script>
</body>
</html>
map(lambda y: filter(lambda x: x != ”, y), map(lambda y: list(y), map(lambda y: y.partition(‘!’), map(lambda y: list(y), map(lambda x: x.partition(split), foo))[0])))