cleaning up

This commit is contained in:
Eric Romano
2013-05-22 12:59:22 -04:00
parent 58289a28b6
commit bded88fcaf
9 changed files with 0 additions and 311 deletions

View File

@ -1,9 +0,0 @@
spawn = (require 'child_process').spawn
to_stdio = (emitter) ->
emitter.stdout.on 'data', (data) -> process.stdout.write data
emitter.stderr.on 'data', (data) -> process.stderr.write data
emitter
task 'build', 'Build game file', (options) ->
to_stdio spawn 'coffee', ['--compile', 'eric.coffee']

View File

@ -1,43 +0,0 @@
dx = 20
[nx, ny] = [30, 20]
canvas = document.getElementById 'canvas'
canvas.width = nx*dx
canvas.height = ny*dx
state = []
for i in [1..ny] by 1
line = []
line.push 0 for j in [1..nx] by 1
state.push line
ctx = canvas.getContext '2d'
color = [
'rgb(255, 255, 255)',
'rgb(204, 255, 255)',
'rgb(153, 255, 255)',
'rgb(102, 255, 255)',
'rgb(51, 255, 255)',
'rgb(0, 255, 255)',
]
redraw = () =>
for i in [0..ny-1] by 1
for j in [0..nx-1] by 1
ctx.fillStyle = color[state[i][j]]
ctx.fillRect j*dx, i*dx, dx, dx
canvas.onmousemove = (e) =>
if (e.pageX || e.pageY)
[x, y] = [e.pageX, e.pageY]
else
x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft
y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop
x -= canvas.offsetLeft
y -= canvas.offsetTop
[i, j] = [Math.floor(y/dx), Math.floor(x/dx)]
state[i][j] += 1
state[i][j] %= 6
redraw()

View File

@ -1,66 +0,0 @@
// Generated by CoffeeScript 1.6.2
(function() {
var canvas, color, ctx, dx, i, j, line, nx, ny, redraw, state, _i, _j, _ref,
_this = this;
dx = 20;
_ref = [52, 7], nx = _ref[0], ny = _ref[1];
canvas = document.getElementById('canvas');
canvas.width = nx * dx;
canvas.height = ny * dx;
state = [];
for (i = _i = 1; _i <= ny; i = _i += 1) {
line = [];
for (j = _j = 1; _j <= nx; j = _j += 1) {
line.push(0);
}
state.push(line);
}
ctx = canvas.getContext('2d');
color = ['rgb(255, 255, 255)', 'rgb(204, 255, 255)', 'rgb(153, 255, 255)', 'rgb(102, 255, 255)', 'rgb(51, 255, 255)', 'rgb(0, 255, 255)'];
redraw = function() {
var _k, _ref1, _results;
_results = [];
for (i = _k = 0, _ref1 = ny - 1; _k <= _ref1; i = _k += 1) {
_results.push((function() {
var _l, _ref2, _results1;
_results1 = [];
for (j = _l = 0, _ref2 = nx - 1; _l <= _ref2; j = _l += 1) {
ctx.fillStyle = color[state[i][j]];
_results1.push(ctx.fillRect(j * dx, i * dx, dx, dx));
}
return _results1;
})());
}
return _results;
};
canvas.onmousemove = function(e) {
var x, y, _ref1, _ref2;
if (e.pageX || e.pageY) {
_ref1 = [e.pageX, e.pageY], x = _ref1[0], y = _ref1[1];
} else {
x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
x -= canvas.offsetLeft;
y -= canvas.offsetTop;
_ref2 = [Math.floor(y / dx), Math.floor(x / dx)], i = _ref2[0], j = _ref2[1];
state[i][j] += 1;
state[i][j] %= 6;
return redraw();
};
}).call(this);

View File

@ -1,14 +0,0 @@
<html>
<head>
<style type="text/css">
body{
margin: 0;
padding: 0
}
</style>
</head>
<body>
<canvas id="canvas">Your browser does no support canvas</canvas>
<script src="eric.js"> </script>
</body>
</html>

View File

@ -1,109 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
shape-rendering: crispEdges;
}
.day {
fill: #fff;
stroke: #ccc;
}
.month {
fill: none;
stroke: #000;
stroke-width: 2px;
}
.RdYlGn .q0-11{fill:rgb(165,0,38)}
.RdYlGn .q1-11{fill:rgb(215,48,39)}
.RdYlGn .q2-11{fill:rgb(244,109,67)}
.RdYlGn .q3-11{fill:rgb(253,174,97)}
.RdYlGn .q4-11{fill:rgb(254,224,139)}
.RdYlGn .q5-11{fill:rgb(255,255,191)}
.RdYlGn .q6-11{fill:rgb(217,239,139)}
.RdYlGn .q7-11{fill:rgb(166,217,106)}
.RdYlGn .q8-11{fill:rgb(102,189,99)}
.RdYlGn .q9-11{fill:rgb(26,152,80)}
.RdYlGn .q10-11{fill:rgb(0,104,55)}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960,
height = 136,
cellSize = 17; // cell size
var day = d3.time.format("%w"),
week = d3.time.format("%U"),
percent = d3.format(".1%"),
format = d3.time.format("%Y-%m-%d");
var color = d3.scale.quantize()
.domain([-.05, .05])
.range(d3.range(11).map(function(d) { return "q" + d + "-11"; }));
var svg = d3.select("body").selectAll("svg")
.data(d3.range(1990, 2011))
.enter().append("svg")
.attr("width", width)
.attr("height", height)
.attr("class", "RdYlGn")
.append("g")
.attr("transform", "translate(" + ((width - cellSize * 53) / 2) + "," + (height - cellSize * 7 - 1) + ")");
svg.append("text")
.attr("transform", "translate(-6," + cellSize * 3.5 + ")rotate(-90)")
.style("text-anchor", "middle")
.text(function(d) { return d; });
var rect = svg.selectAll(".day")
.data(function(d) { return d3.time.days(new Date(d, 0, 1), new Date(d + 1, 0, 1)); })
.enter().append("rect")
.attr("class", "day")
.attr("width", cellSize)
.attr("height", cellSize)
.attr("x", function(d) { return week(d) * cellSize; })
.attr("y", function(d) { return day(d) * cellSize; })
.datum(format);
rect.append("title")
.text(function(d) { return d; });
svg.selectAll(".month")
.data(function(d) { return d3.time.months(new Date(d, 0, 1), new Date(d + 1, 0, 1)); })
.enter().append("path")
.attr("class", "month")
.attr("d", monthPath);
d3.csv("dji.csv", function(error, csv) {
var data = d3.nest()
.key(function(d) { return d.Date; })
.rollup(function(d) { return (d[0].Close - d[0].Open) / d[0].Open; })
.map(csv);
rect.filter(function(d) { return d in data; })
.attr("class", function(d) { return "day " + color(data[d]); })
.select("title")
.text(function(d) { return d + ": " + percent(data[d]); });
});
function monthPath(t0) {
var t1 = new Date(t0.getFullYear(), t0.getMonth() + 1, 0),
d0 = +day(t0), w0 = +week(t0),
d1 = +day(t1), w1 = +week(t1);
return "M" + (w0 + 1) * cellSize + "," + d0 * cellSize
+ "H" + w0 * cellSize + "V" + 7 * cellSize
+ "H" + w1 * cellSize + "V" + (d1 + 1) * cellSize
+ "H" + (w1 + 1) * cellSize + "V" + 0
+ "H" + (w0 + 1) * cellSize + "Z";
}
d3.select(self.frameElement).style("height", "2910px");
</script>

View File

@ -1,43 +0,0 @@
var color = [
'rgb(255, 255, 255)',
'rgb(200, 255, 255)',
'rgb(150, 255, 255)',
'rgb(100, 255, 255)',
'rgb(50, 255, 255)',
'rgb(0, 255, 255)',
]
var paint=0
document.body.addEventListener('mousedown', function(){paint=1;console.log('painting');}, false );
document.body.addEventListener('mouseup',function(){paint=0;console.log('released')}, false);
function box(){
var box = document.createElement("div");
box.value=0;
box.style.width='25px';
box.style.height='25px';
box.style.border='1px solid gray';
box.style.backgroundColor=color[0];
box.paint=0
//box.onclick = function() { cycle(this);};
box.addEventListener('mousemove', function(){cycle(this);}, false );
document.body.appendChild(box);
return box
};
function boxes(){
var column = [];
for (i=0;i<7;i++){
column[i]=box();
}
}
function cycle(object){
if (paint==1){
object.value+=0.5;
object.value%6;
object.style.backgroundColor=color[object.value];
}
}
boxes();

View File

@ -1,15 +0,0 @@
#!/bin/env python
#gitfiti_web
from bottle import request, route, run, post, template
@route("/")
def index():
return template('index')
@route()
def main():
run(host='localhost', port=8080, debug=True, reloader=True)
if __name__ == '__main__':
main()

View File

@ -1,5 +0,0 @@
<!DOCTYPE html>
<head>
</head>
<body><script src='gitfiti.js'></script>
</body>

View File

@ -1,7 +0,0 @@
login page
<html>
<head>
<form>
<input>
</form>