Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Spiros Eliopoulos seliopou

💭
I may be slow to respond.
View GitHub Profile
@seliopou
seliopou / GhcAPI.hs
Created Nov 5, 2012
Boilerplate module for dynamically compiling, loading, and evaluating Haskell code.
View GhcAPI.hs
-- Boilerplate module for dynamic compilation, loading, and evaluation of
-- modules using the GHC API, v. 7.4.1. Note that the GHC API is subject to
-- change, so this file may not work for future versions.
--
-- Load and play around with this file using:
--
-- ghci -package ghc -XCPP GhcAPI.hs
--
-- or
--
@seliopou
seliopou / HintExample.hs
Created Nov 5, 2012
Boilerplate module for dynamically compiling, loading, and evaluating Haskell code using hint.
View HintExample.hs
-- Boilerplate module for dynamic compilation, loading, and evaluation of
-- modules using hint.
--
-- Load and play around with this file using:
--
-- ghci -package hint HintExample.hs
--
module HintExample where
import Language.Haskell.Interpreter
@seliopou
seliopou / dates.js
Created Nov 15, 2012
Render some dates
View dates.js
var dates = [...],
width = ...,
height = ...;
var xscale = d3.scale.linear().domain([0, dates.length]).range([0, width]);
var canvas = d3.select('#canvas')
.append('svg:svg')
.attr('width', width)
.attr('height', height);
@seliopou
seliopou / responsive_d3_example.html
Created Nov 17, 2012 — forked from rduplain/responsive_d3_example.html
Responsive d3.js D3 Javascript Histogram Example
View responsive_d3_example.html
<!DOCTYPE html>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
body {
font: 10px sans-serif;
}
rect {
@seliopou
seliopou / index.html
Created Nov 20, 2012
d3.js animation pattern
View index.html
<!DOCTYPE html>
<html>
<head>
<title>d3.js animation pattern</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="vis.js"></script>
<style type="text/css">
body {
@seliopou
seliopou / script_tag.html
Created Nov 20, 2012
A Conditional Animation Pattern for d3 - script tag
View script_tag.html
<form>
<input id="back_detect" type="hidden" name="back_detect" value="" />
</form>
<script type="text/javascript">
/* Render vis, animating only if value is set to "" */
vis("#canvas", $("#back_detect").val() == "");
/*
* Set the value of the form field to "visited". Most browsers will
@seliopou
seliopou / index.html
Created Nov 21, 2012
d3.js example | circle packing in a rectangle
View index.html
<!DOCTYPE html>
<html>
<head>
<title>d3.js example | circle packing in a rectangle</title>
<script src="http://d3js.org/d3.v2.js"></script>
<style type="text/css">
</style>
</head>
<body>
<div id="canvas"></div>
@seliopou
seliopou / chart.js
Created Dec 18, 2012
A reusable chart combinator for D3.
View chart.js
var chart = (function() {
function copy(o) {
return Object.keys(o).reduce(function(no, k) {
no[k] = o[k];
return no;
}, {});
}
return function(defaults, _cstr) {
return function() {
View index.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>twenty-five suns</title>
<style>
svg {
background: rgb(237, 237, 237);
}
path {