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 / depth_chart.html
Last active April 21, 2023 14:00
D3 Market Depth Chart built from Order Book
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>d3 depth chart</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<style>
@flavioespinoza
flavioespinoza / WebsocketSample.js
Last active September 13, 2021 19:31
Bittres Websocket Node.js Authentication Example
/**
* Node.js example
* https://github.com/Bittrex/beta
*
* By Flavio Espinoza
*
* Expanding on example from Adrian Soluch
*
* prerequisites:
* npm i signalr-client crypto lodash ololog