Skip to content

Instantly share code, notes, and snippets.

View iros's full-sized avatar

Irene Ros iros

View GitHub Profile
@iros
iros / README.md
Created April 6, 2016 17:50
D3 Force Layout + Pixi.js Experiment
@iros
iros / fullscreen.js
Created November 21, 2013 16:05
Full screening
if (document.body.requestFullscreen ||
document.body.mozRequestFullScreen ||
document.body.webkitRequestFullscreen
) {
$("<button>View this chart in Full Screen</button>")
.on('click', function (e) {
var root = $interactive.get(0);
if (root.requestFullscreen) { root.requestFullscreen(); }
else if (root.mozRequestFullScreen) { root.mozRequestFullScreen(); }
else if (root.webkitRequestFullscreen) { root.webkitRequestFullscreen(); }
@iros
iros / 01.mobile.test.js
Last active December 24, 2015 22:49
d3.chart.base modes post
modes: {
mobile : function() {
// if the chart is less than 480 pixels wide or the
// screen is less than 480px wide
return this.width() <= 480 ||
Modernizr.mq("only all and (max-width: 480px)");
},
}
@iros
iros / allie.md
Last active December 20, 2015 12:08
Allie, the Definitive Guide

Allie, the Definitive Guide

Greetings. You have been chosen for the critical mission "Allie 3000". Congratulations! Allie Monkeyface Duchess of Central Square, a female canine, is now in your care. The fate of her universe is now in your hands. It is our hope that this guide will provide you sufficient instructions to complete the mission.

If you need to reach me at any point, my number is: 413-265-3704.

Eating

@iros
iros / Readme.md
Created July 10, 2013 04:53
Chicas Poderosas - d3 + miso.dataset + rickshaw
@iros
iros / README.md
Last active December 19, 2015 13:39
Chicas Poderosas - d3 + miso.dataset + rickshaw
@iros
iros / 01.instantiate.js
Last active December 17, 2015 19:19
D3.chart Intro Post
var data = [1,4,6,9,12,13,30];
var circleChart = d3.select("div#vis")
.append("svg")
.chart("CircleChart")
.width(200)
.height(100)
.radius(3);
// render it with some data
circleChart.draw(data);
var data = [1,3,5,10,11,12,50];
var width = 500,
height = 100,
r = 5;
var xScale = d3.scale.linear()
.range([5, width-r])
.domain([1,50]);
@iros
iros / ts.js
Created March 24, 2013 02:36
transform svg element around its center
// transform around center:
// formula: matrix(sx, 0, 0, sy, cx-sx*cx, cy-sy*cy)
var b = el.getBBox();
var center = [b.x + b.width/2, b.y + b.height/2];
var factor = 1.8;
el.attr('transform','matrix(' + factor + ', 0, 0, ' + factor + ', ' +
(center[0] - factor * center[0]) +
',' + (center[1] - factor * center[1])+')');
@iros
iros / article.json
Created February 27, 2013 15:15
sample processed article for GenderTracker
{
"url": "http://mynewsapp.com/article/19928034",
"id": "19928034",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vitae lorem quam, a luctus quam. Proin scelerisque cursus dolor, ut iaculis urna tempus vitae.",
"original_body": "<b>Lorem ipsum</b> dolor sit amet, consectetur adipiscing elit. Pellentesque vitae lorem quam, a luctus quam. Proin scelerisque cursus dolor, ut iaculis urna tempus vitae. ",
"title": "Lorem ipsum",
"byline": "By Cicero",
"pub_date": "1011-01-04T16:00:25Z",
"decompositions": {
"sentences": [