[ Launch: Tributary inlet ] 5f69b962394b2276092e by seliopou
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* rdio_scrape.js | |
* | |
* Quick and dirty script to scrape a playlist from Rdio and print it to the | |
* console in a csv format. | |
* | |
* XXX NB TODO READ THIS: Playlists are loaded lazily by Rdio, so make sure | |
* that when you navigate to a new playlist page you scroll from beginning to end | |
* and back again, making sure that all the songs have been rendered on the way | |
* back up. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>twenty-five suns</title> | |
<style> | |
svg { | |
background: rgb(237, 237, 237); | |
} | |
path { |
[ Launch: Tributary inlet ] 4981624 by seliopou
Instead of adding methods to d3.selection
, make a transform its own object that you can define independently of a selection. So this...
d3.selectAll("g.label")
.translate(function(d) { return [20,d.x*10]})
.rotate(40)
.scale(function(d) {return [d.size,2]})
... would turn into this:
An unnecessarily thorough analysis
When you look at the behavior of the methods on a d3.selection
, they fall into one of two categories:
- those that create a new selection, e.g.,
.filter()
,.exit()
,.enter()
,.append()
, etc.; and - those that mutate the existing selection, e.g.,
.attr()
,.style()
,on()
, etc.
Question: Are these categories disjoint and exhaustive?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var g = svg.selectAll('g') | |
.data(/* the data */) | |
g.enter().append('circle') | |
g.selectAll('circle') | |
.attr('r', function(d) { /* radius */ }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Permutation | |
( permute -- :: RandomGen g => [a] -> g -> ([a], g) | |
, permuteST -- :: RandomGen g => [a] -> g -> ST s ([a], g) | |
, permuteIO -- :: [a] -> IO [a] | |
, unsafePermute -- :: [a] -> [a] | |
) where | |
import Control.Monad ( foldM ) | |
-- N.B. Unsafe operations have been deprecated in the original module and have | |
-- been moved to Control.Monad.ST.Unsafe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./pure_benchmark.native -q 30 +time # 4.02.3 | |
Estimated testing time 1m (2 benchmarks x 30s). Change using -quota SECS. | |
┌──────┬──────────┬──────────┬───────────────┬─────────┬──────────┬──────────┬────────────┐ | |
│ Name │ Time R^2 │ Time/Run │ 95ci │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │ | |
├──────┼──────────┼──────────┼───────────────┼─────────┼──────────┼──────────┼────────────┤ | |
│ json │ 1.00 │ 21.16ms │ -0.59% +0.62% │ 18.67Mw │ 239.28kw │ 239.28kw │ 47.53% │ | |
│ http │ 1.00 │ 44.52ms │ -0.28% +0.29% │ 32.01Mw │ 65.11kw │ 65.11kw │ 100.00% │ | |
└──────┴──────────┴──────────┴───────────────┴─────────┴──────────┴──────────┴────────────┘ | |
$ ./pure_benchmark.native -q 30 +time # 4.03.0+flambda | |
Estimated testing time 1m (2 benchmarks x 30s). Change using -quota SECS. |