Skip to content

Instantly share code, notes, and snippets.

View flavioespinoza's full-sized avatar
😎

Flavio Espinoza flavioespinoza

😎
View GitHub Profile
@flavioespinoza
flavioespinoza / index.html
Created November 6, 2012 17:28 — forked from benjchristensen/index.html
Interactive Line Graph (D3)
<html>
<head>
<title>Interactive Line Graph</title>
<script src="http://d3js.org/d3.v2.js"></script>
<!--
using JQuery for element dimensions
This is a small aspect of this example so it can be removed fairly easily if needed.
-->
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="sample_data.js"></script>
# Example Backbone.js app in CoffeeScript
# compile on each file save using the coffee bin
# coffee -b -c -w app.coffee
# BACKBONE.JS MODEL
class Blog extends Backbone.Model
sync: -> "noop"
url: ->
@flavioespinoza
flavioespinoza / README.md
Created November 9, 2012 05:39 — forked from mbostock/.block
Line Transition

D3’s default path interpolation is the same as its string interpolation: it finds numbers embedded in strings, and interpolates those numbers. So, the default behavior when interpolating two paths is like this:

M x0, y0 L x1, y1 L x2, y2 L x3, y3 
   ↓   ↓    ↓   ↓    ↓   ↓    ↓   ↓
M x0, y1 L x1, y2 L x2, y3 L x3, y4 

For example, the first point ⟨x0,y0⟩ is interpolated to ⟨x0,y1⟩. Since x0 is the same, all you see are the y-values changing (see example)—you don't see the path slide to the left as intended.

What you want to happen here is something like this:

@flavioespinoza
flavioespinoza / d3.v2.patched.js
Created November 29, 2012 16:48 — forked from benjchristensen/d3.v2.patched.js
Issue 655 Example (Patch)
// patched version of d3.v2.js
// bug report that this patches is at https://github.com/mbostock/d3/issues/655
(function(){if (!Date.now) Date.now = function() {
return +new Date;
};
try {
document.createElement("div").style.setProperty("opacity", 0, "");
} catch (error) {
var d3_style_prototype = CSSStyleDeclaration.prototype,
@flavioespinoza
flavioespinoza / .gitignore
Created November 29, 2012 17:12 — forked from GerHobbelt/.gitignore
d3.bisect() usage to get Y value for mouse X where x axis is a timestamp/date
# Editor backup files
*.bak
*~
@flavioespinoza
flavioespinoza / README.md
Created November 29, 2012 17:51 — forked from mbostock/.block
UT1 - UTC

A recreation of Nelson Minar’s graph, experimenting with some subtle mousemove features to allow closer inspection. Also duplicates the x axis labels to improve readability via white stroke.

/*jshint globalstrict:true */
/*global angular:true */
'use strict';
angular.module('demo', [
'demo.controllers',
'demo.directives',
'elasticjs.service'
]);
@flavioespinoza
flavioespinoza / PascalsTriangles.js
Created June 7, 2018 14:16 — forked from kgates-github/PascalsTriangles.js
Two ways to create a Pascal's Triangle in JavaScript.
var numTiers = 100,
triangle,
start,
stop;
/**
*
* First version uses recursion
*
*/
const express = require('express')
const app = express()
const port = process.env.PORT || 9001
const http = require('http')
const index = require('./routes/index')
const server = http.createServer(app)
const socketIo = require('socket.io')
const io = socketIo(server)
const BitGoJS = require('bitgo')
const log = require('ololog').configure({locate: false})