Basic example:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
var _stage = document.getElmenetById('stage'), | |
stage = bonsai.run(stage, 'movie.js') | |
stage.on('message', function (data) { | |
// include in data things like event type, target, and other data, fork off to appropriate method from here. | |
console.log('message', data); | |
}) |
// the power of dom utilities and selector engines | |
// $('table.projects tr:even').addClass('even-row'); | |
var slice = Array.prototype.slice, | |
toArray = function (obj) { | |
return Array.prototype.slice.call(obj, 0) | |
} | |
var tables = toArray(document.querySelectorAll('table.projects')) |
Basic example:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
colorscheme molokai | |
set statusline+=%{fugitive#statusline()} | |
" let g:tagbar_type_javascript = { 'ctagsbin' : 'jsctags' } | |
au BufRead,BufNewFile *.sass set foldmethod=marker | |
au BufRead,BufNewFile *.css set foldmethod=marker | |
au BufRead,BufNewFile *.styl set foldmethod=marker |
// slightly edited schema. | |
[{ name: 'string', | |
months: 'string', | |
id: 'string', | |
special: 'string', | |
full_rate: 'string', | |
description: 'string', | |
type: 'string', | |
renew_rate: 'string' | |
}] |
function rgbToHsl(r, g, b) { | |
/* r === rgb pixel object || r value*/ | |
var h, s, l, min, max, _full = 255; | |
if (arguments.length < 2) | |
r = r.red / _full, g = r.green / _full, b = r.blue / _full | |
else | |
r /= _full, g /= _full, b /= _full | |
min = Math.min(r,g,b) | |
max = Math.max(rgb) |
var attrs = { 'data-stroke': 'rgb(0,0,0)', | |
'fill': 'rgb(94,93,127)', | |
'fill-opacity': '1', | |
'fill-rule': 'inherit', | |
'opacity': '1', | |
'stroke-linecap': 'butt', | |
'stroke-linejoin': 'miter', | |
'stroke-miterlimit': '4', | |
'stroke-opacity': '1', | |
'stroke-width': '0', |
table.graph | |
- var widths = 0 | |
each answer in insight.answers | |
- var width = (insight.totalResponseCount>0) ? (insight.responseCount[answer] / insight.totalResponseCount * 100) : 0 | |
- widths += width | |
tr | |
th(scope='row')= answer | |
td: span.line(style='width:#{width}%', title='#{ answer.numberResponses } (#{ width }%)') |
function pixelToGrayscale(pixel) { | |
// Convert to grayscale. An explanation of the ratios | |
// can be found here: http://en.wikipedia.org/wiki/Grayscale | |
var grayScaled = (pixel.red * 0.3) | |
+ (pixel.green * 0.59) | |
+ (pixel.blue * .11) | |
return grayScaled | |
} |
// stroke-dasharray for bonsai | |
// new DashedStroke arguments: | |
// arg1 => color | |
// arg2 => array of solid, space pixel values to create shape | |
displayObject.stroke = new DashedStroke('#ff8800', [8, 3, 6, 1]) | |
// canvas would create something that looks like this: | |
// ######## ###### | |
// ######## ###### |