Skip to content

Instantly share code, notes, and snippets.

View EvanZ's full-sized avatar

Evan Zamir EvanZ

  • Pinpoint Predictive
  • San Francisco
View GitHub Profile
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="200px" height="200px" viewBox="0 0 200 200">
<!-- guide lines -->
<path d="M 20 10, 20 120 M 10 30 100 30 M 10 70 100 70
M 10 110 100 110" style="stroke: gray;"/>
<text x="20" y="30">Simplest Text</text>
@EvanZ
EvanZ / index.html
Created June 18, 2012 04:10
creating a bar chart in D3
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style type="text/css">
</style>
</head>
<body>
<script>
var players = [
@EvanZ
EvanZ / gist:3029682
Created July 1, 2012 21:17
drawing chemical structure with d3.js
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style type="text/css">
.link {
fill: steelblue;
stroke: lightgray;
stroke-width: 2px;
}
@EvanZ
EvanZ / gist:4146443
Created November 26, 2012 03:18
matchup example
{
"_id" : ObjectId("50b2d404597f1444a8000456"), //BSON identifier for MongoDB
"espn_id" : "400277756",
"date" : "2012-11-03",
"q" : 2, //quarter #2
"mid" : 4, //5th matchup of quarter (starting lineup of each period has mid=0),
"hs" : 38, //home score at end of stint
"as" : 43, //away score at end of stint
"start" : "8:27", //started at...
"end" : "6:15", //ended at...
@EvanZ
EvanZ / gist:4254345
Created December 10, 2012 23:36
query
exports.shots = function(req, res){
console.log(req.route.params.team);
var team = req.route.params.team;
Db.connect(mongoUri, function(err, db) {
console.log('show all shots!');
db.collection('shots', function(err, coll) {
coll.find({'for':team}).sort({'date':-1,'dist':-1}).toArray(function(err, docs) {
db.close();
res.render('shots',{shots: docs, team: team});
});
@EvanZ
EvanZ / gist:4254372
Created December 10, 2012 23:39
jade template
extends layout
block content
div.hero-unit
h1 #{shots[0].for}
div.row
div.span2.offset1
svg(width=600,height=600)
each shot in shots
@EvanZ
EvanZ / gist:4254422
Created December 10, 2012 23:45
generated html
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v2.js"></script>
</head><link rel="stylesheet" href="/stylesheets/bootstrap/docs/assets/css/bootstrap.css">
<body>
<div class="hero-unit">
<h1>Warriors</h1>
</div>
$ /usr/local/share/npm/bin/jitsu deploy
info: Welcome to Nodejitsu ezamir
info: jitsu v0.13.2, node v0.10.5
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
warn: **WARNING** Do not use multiple level subdomains, they will be going away soon!
info: Analyzing application dependencies in app.js
WARN package.json [email protected] No repository field.
WARN package.json [email protected] No repository field.
WARN package.json [email protected] No repository field.
@EvanZ
EvanZ / index.html
Created December 5, 2013 02:49
Scatterplot
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://polychart.com/s/third_party/polychart2.standalone.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
(ns flambo.clojure.spark.demo
(:require [flambo.conf :as conf])
(:require [flambo.api :as f])
(:require [clojure.data.json :as json]))
(def c (-> (conf/spark-conf)
(conf/master "local[*]")
(conf/app-name "nba_dsl")))
(def sc (f/spark-context c))