Skip to content

Instantly share code, notes, and snippets.

View cscheid's full-sized avatar

Carlos Scheidegger cscheid

View GitHub Profile
@cscheid
cscheid / index.html
Created August 22, 2012 22:47
Some d3 tests
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.0"></script>
</head>
<body><div id="test"></div>
<script>
var names = ["v1",
"v2",
"v3",
"v4",
@cscheid
cscheid / README.md
Created November 28, 2012 18:41 — forked from mbostock/.block
Gradient Along Stroke

This example demonstrates how to create a gradient that follows a stroke. This technique is sometimes used to indicate directionality along a curved edge, such as with hierarchical edge bundling.

To start, take any SVG path element and uniformly sample points along the path using getPointAtLength. (This method can also be used for path tweening.) Then, for each segment between adjacent points, compute the miter joint via line-line intersection. Lastly fill each segment by interpolating the start and end colors, here green to red, using the normalized length t along the path. Although each segment is a constant color, there are many segments to give the appearance of a continuous gradient.

This example uses a thin stroke in addition to filling the segments. This avoids antialiasing artifacts due to most

@cscheid
cscheid / crash.cpp
Last active December 12, 2015 08:39
This crashes g++ 4.2.1 (the default OS X 10.8 compiler) with an ICE.
template <typename T>
void fun(T* obj) {}
template <typename T, void Fun(T*) = fun<T> >
struct S {
S(int m_sexp) {};
};
template <typename T>
S<T> ptr(int s) { return S<T>(s); }
@cscheid
cscheid / another_test.txt
Last active December 16, 2015 13:58
Some gist
hoaskdhskldf
@cscheid
cscheid / gist:5449235
Last active December 16, 2015 14:29
testing weirdness on http://developer.github.com docs
This is a test file
We can't make this file beautiful and searchable because it's too large.
Area State,Area Type,Area,City,Date,LAUS Code,State,Area FIPS Code,Employed,Labor Force,Month,State FIPS Code,Unemployed,Unemployment Rate,Year
ME,Met NECTA,Portland-South Portland-Biddeford,Portland,1/1/2000,MT237675,ME,76750,184223,189622,1,23,5399,2.8,2000
ME,Met NECTA,Bangor,Bangor,1/1/2000,MT237075,ME,70750,64191,66618,1,23,2427,3.6,2000
ME,Met NECTA,Lewiston-Auburn,Lewiston,1/1/2000,MT237465,ME,74650,52934,54950,1,23,2016,3.7,2000
MA,Met NECTA,Pittsfield,Pittsfield,1/1/2000,MT257660,MA,76600,37117,38301,1,25,1184,3.1,2000
MA,Met NECTA,Leominster-Fitchburg-Gardner,Leominster,1/1/2000,MT257450,MA,74500,71032,73398,1,25,2366,3.2,2000
MA,Met NECTA,Barnstable Town,Barnstable Town,1/1/2000,MT257090,MA,70900,121657,125999,1,25,4342,3.4,2000
MA,Met NECTA,New Bedford,New Bedford,1/1/2000,MT257555,MA,75550,79221,82833,1,25,3612,4.4,2000
MA-CT,Met NECTA,Worcester,Worcester,1/1/2000,MT257960,MA,79600,273295,281124,1,25,7829,2.8,2000
MA-CT,Met NECTA,Springfield,Springfield,1/1/2000,MT257810,MA,78100,326271,336515,1,
@cscheid
cscheid / README.md
Last active December 20, 2015 20:59
Unbreak agnoster powerline

Unbreak the powerline changes in the agnoster theme

If you use a hard-to-find patched powerline font such as Monaco like I do, the patch above will help you by reverting the latest glyph moves.

Use it like this:

$ cd .oh-my-zsh/themes
$ patch -p2 < unbreak_powerline.patch

Restart Terminal, iterm2, or whatever you use, and your powerline font should be working again.

@cscheid
cscheid / monads.js
Created August 15, 2013 15:34
sequence_ in javascript. sigh
function sequence_(lst)
{
function do_it(i) {
if (i === lst.length)
return;
lst[i](function() {
do_it(i+1);
});
}
do_it(0);
@cscheid
cscheid / f1.txt
Created October 3, 2013 21:13
test
the content.
@cscheid
cscheid / foo.py
Last active December 24, 2015 22:59
Simulating a bad encoding of subsets
#!/usr/bin/env python
import sys
import math
chosen = set()
def choose(n, k):
return math.gamma(n+1) / (math.gamma(k+1) * math.gamma(n-k+1))
def yield_all_choices(n, k):