Skip to content

Instantly share code, notes, and snippets.

@jstcki
jstcki / gist:294640
Created February 4, 2010 13:56
Redirect HTTP to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>
@jstcki
jstcki / nest.rb
Created October 29, 2012 16:35
D3.js's nest operator in Ruby
# D3.js's nest operator in Ruby
class Nest
def initialize
# var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
@nest = {}
@keys = []
@sort_keys = []
end
@jstcki
jstcki / README.md
Created December 18, 2012 12:48
Swiss Cantons and Municipalities

Map of Switzerland with TopoJSON and map data from Swiss Maps. Cantons and municipalities are combined in a single TopoJSON file.

@jstcki
jstcki / Readme.md
Last active June 23, 2022 17:32 — forked from wiederkehr/Readme.md
Streamgraph to multiple area charts

Example of a streamgraph that can be divided into multiple area charts.

@jstcki
jstcki / index.js
Created March 18, 2013 17:23
D3 Data Tutorial
require("http://d3js.org/d3.v3.js");
var data = [{"id":"ARE","pop":7890924,"country_name":"United Arab Emirates"},
{"id":"ARG","pop":40764561,"country_name":"Argentina"},
{"id":"AUS","pop":22620600,"country_name":"Australia"}];
// How many items are in the data?
var dataCount = data.length;
@jstcki
jstcki / README.md
Last active December 16, 2015 05:49
Zipdecode Switzerland
@jstcki
jstcki / README.md
Last active December 16, 2015 06:19
ZipScribble Switzerland
@jstcki
jstcki / README.md
Last active November 18, 2018 18:22
Polylinear Time Scale

When creating a polylinear time scale, the tricky part is to know to which value in the range the intermediate dates should map.

Let's say we want to "zoom in" on 4 particular days and make them appear with the size of 10 days each. Because these days now take up more space (36 or (factor - 1) * n), we need to create a linear time scale where the domain ends at 36 days later than we want to show. This scale is then used to determine the intermediary range values of the polylinear scale.

@jstcki
jstcki / README.md
Last active December 16, 2015 17:08
Indented tree layout
@jstcki
jstcki / README.md
Last active February 10, 2017 21:23
Grid layout