Skip to content

Instantly share code, notes, and snippets.

View vpascual's full-sized avatar

Víctor vpascual

View GitHub Profile
@vpascual
vpascual / gist:2731584
Created May 19, 2012 17:24
Simple example of a D3 tooltip
<html>
<head>
<title>D3 tooltip</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.min.js"></script>
</head>
<body>
<script type="application/javascript">
var w = 960,
h = 500;
@vpascual
vpascual / parseSeriesRatings.R
Last active December 27, 2015 15:09
Parse the ratings of a series from IMDB (see http://www.imdb.com/title/tt0898266/epdate?ref_=ttep_ql_4)
# NOTE: This code works with the HTML code existing in imdb.com as today (06-11-2013)
# The URL with the user ratings per episode always ends with "/epdate?ref_=ttep_ql_4",
# so if the URL for Breaking Bad in IMDB is http://www.imdb.com/title/tt0903747/, the URL with
# the ratings is http://www.imdb.com/title/tt0903747/epdate?ref_=ttep_ql_4
parseSeriesRatings <- function(url) {
require(XML)
# download the data
rawData <- readHTMLTable(url, colClasses=c("character", "character", "character", "character"))
@vpascual
vpascual / index.html
Last active August 29, 2015 14:02
Values are generated when hovering the blue or red circles. Two bars fill according to the percentage of values created per color
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
'use strict';
angular.module('solrExplorerApp')
.factory('SolrRequester', function ($q, $http) {
return function(queries) {
var promises = queries.map( function(file) {
var deffered = $q.defer();
@vpascual
vpascual / remove_accents.py
Created March 24, 2016 09:04
This little function gets a text in UTF-8 and returns the same string without accents. It is useful for comparing texts
def remove_accents(text):
return unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ASCII', 'ignore')
@vpascual
vpascual / .blocks
Last active February 26, 2017 19:03
SVG circles on mouse position fading away
license: gpl-3.0
@vpascual
vpascual / .block
Last active February 27, 2018 18:38
Vega-Lite Bl.ocks example
license: mit
@vpascual
vpascual / .block
Last active February 28, 2018 16:38
Basic D3 page template
license: mit
@vpascual
vpascual / .block
Last active February 28, 2018 16:45
D3 basic barchart with divs
license: mit
@vpascual
vpascual / .block
Created February 28, 2018 16:52
Barchart with SVG
license: mit