[ Launch: sparc menu cf2 ] 6636757 by zeffii
[ Launch: sparc menu cf ] 6624241 by zeffii
[ Launch: sparc menu cf ] 6574751 by zeffii
[ Launch: sparc menu ] 6572134 by zeffii
[ Launch: sparc menu ] 6566151 by enjalot
-
-
Save zeffii/6636757 to your computer and use it in GitHub Desktop.
sparc menu cf2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"sparc menu cf2","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"menu.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/2a8ofU7.png"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/enjalot/sparcscraps | |
#using scrapy http://doc.scrapy.org/en/0.18/intro/tutorial.html | |
#to scrape http://sparcsf.org/medicine/flowers | |
svg = d3.select("svg") | |
svg.append("rect").attr({width:"100%", height:"100%", fill: '#E2E2E2'}) | |
markers = ["pre-roll", "g", "1/8", "1/4", "oz"] | |
data = tributary.menu | |
# | |
# user functions and constants | |
# | |
pop_prices = (d) -> | |
rval = "" | |
for i in [0..d.prices.length] | |
price = d.prices[i] | |
if (price > 0) | |
rval += (markers[i] + ": $" + price + "<br/>") | |
rval | |
fake_min = (d) -> | |
raw_min = d3.min(d.prices) | |
if raw_min > -1 then raw_min else d3.max(d.prices) | |
style_ball = | |
fill: '#C5C5C5', | |
stroke: '#686868' | |
'stroke-width': 1 | |
cbd_style = | |
fill: '#FF2525' | |
stroke: '#F3F3F3' | |
'stroke-width': 2.64 | |
line_height = 20 | |
type_y_offset = 3.52 | |
rip_color = '#7CCAE2' | |
price_radius = 7 | |
# | |
# svg composition | |
# | |
group1 = svg.append('g') | |
.classed('group1', true) | |
.attr | |
transform: 'translate(' + [172, 65] + ')' | |
tgroups = group1.selectAll('g').data(data).enter() | |
strain = tgroups.append('g') | |
.classed('strain', true) | |
.style style_ball | |
# prices | |
strain | |
.attr title: (d) -> d.strain | |
strain.append('path') | |
.attr | |
d: (d, i) -> | |
p1 = {x: min_val = fake_min(d), y:i*line_height} | |
p2 = {x: d3.max(d.prices), y:i*line_height} | |
'M' + [p1.x, p1.y, p2.x, p2.y] | |
.style | |
stroke: '#FAC1C1' | |
'stroke-width': 8 | |
# price to thc | |
strain.append('path') | |
.attr | |
d: (d, i) -> | |
tval = d.thc | |
if tval >= 0 | |
tval = d.thc* 10 | |
y = i*line_height | |
p1 = {x: tval, y:y} | |
p2 = {x: d3.max(d.prices), y:y} | |
'M' + [p1.x, p1.y, p2.x, p2.y] | |
.style | |
stroke:rip_color | |
'stroke-width': 8 | |
# max price | |
strain.append('circle') | |
.attr | |
r: price_radius | |
transform: (d, i) -> | |
'translate(' + [d3.max(d.prices), i*line_height] + ')' | |
title: (d) -> pop_prices(d) | |
# min price | |
strain.append('circle') | |
.attr | |
r: price_radius | |
transform: (d, i) -> | |
min_val = fake_min(d) | |
'translate(' + [min_val, i*line_height] + ')' | |
title: (d) -> pop_prices(d) | |
# strain name | |
strain.append('text') | |
.text((d)-> d.name) | |
.style | |
'font-size': 10 | |
'text-anchor': 'end' | |
stroke: 'none' | |
fill: '#123' | |
.attr | |
transform: (d, i) -> | |
pos = [-13, i*line_height + type_y_offset] | |
'translate(' + pos + ')' | |
# thc % | |
strain.append('circle') | |
.attr | |
r: (d) -> | |
tval = d.thc | |
if tval >= 0 then 7 else 0 | |
transform: (d, i) -> | |
tval = d.thc | |
if tval >= 0 | |
tval = d.thc* 10 | |
'translate(' + [tval, i*line_height] + ')' | |
title: (d) -> | |
tval = d.thc | |
if tval < 0 then 'thc unknown' else 'thc: ' + tval + '%' | |
.style | |
fill: rip_color | |
stroke: 'none' | |
# cbd % | |
strain.append('circle') | |
.attr | |
r: (d) -> | |
if d.cbd > 0 then 7 else 0 | |
transform: (d, i) -> | |
'translate(' + [d.cbd*10, i*line_height] + ')' | |
title: (d) -> | |
tval = d.cbd | |
if tval < 0 then 'cbd unknown' else 'cbd: ' + tval + '%' | |
.style cbd_style | |
$("g").tipsy({gravity: 'nw', offset: 10, delayIn: 200, fade: true}) | |
$("circle").tipsy({gravity: 'sw', html: true, delayIn: 200, fade: true}) | |
# EOF # | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.cm-s-elegant.CodeMirror { background: #1e2426; color: #696969; } | |
.cm-s-elegant div.CodeMirror-selected {background: #064968 !important;} /* 33322B*/ | |
.cm-s-elegant span.cm-variable { color:#22EFFF; } | |
.cm-s-elegant span.cm-variable-2 { color: #FFCCB4; } | |
.cm-s-elegant span.cm-variable-3 { color: white; } | |
.cm-s-elegant span.cm-string { color: Chartreuse; } | |
.cm-s-elegant span.cm-string-2 {color: Chartreuse;} | |
.cm-s-elegant span.cm-def {color: #FFCCB4; opacity: 1.0} | |
.cm-s-elegant span.cm-bracket { color: #EBEFE7; } | |
.cm-s-elegant pre { color:#FFF; } | |
.cm-s-elegant span.cm-qualifier { color:#C0C0C0; } | |
.cm-s-elegant span.cm-comment { color: #AFB4B4;} | |
.cm-s-elegant span.cm-property {color: #FDA676;} | |
.cm-s-elegant span.cm-number { color: #FF92EE;} | |
.cm-s-elegant span.cm-keyword { color: #FFFF18; } | |
.cm-s-elegant .CodeMirror-cursor { border-left: 1px solid white !important; } | |
.cm-s-elegant .CodeMirror-gutters {background: #505050;} | |
.cm-s-elegant .CodeMirror-linenumber {color: #D3D3D3;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment