Skip to content

Instantly share code, notes, and snippets.

View donaldh's full-sized avatar
💯

Donald Hunter donaldh

💯
View GitHub Profile
@donaldh
donaldh / index.html
Created June 12, 2012 15:08
Modified force-multi-foci.html to add a convex hull
<!DOCTYPE html>
<html>
<head>
<title>Force-Directed Layout with Convex Hull</title>
<script src="http://mbostock.github.com/d3/d3.js?2.7.4"></script>
</head>
<body>
<div id="chart"></div>
<script type="text/javascript">
@donaldh
donaldh / README.md
Created June 12, 2012 22:36
force-multi-foci with convex hulls

I have modified the force-multi-foci example to add a convex hull around each cluster of nodes.

I achieved this by using d3.nest() to create a new dataset of clusters containing the nodes in each cluster. Then in the tick() method I create and update the path element for each cluster in this dataset.

@donaldh
donaldh / index.html
Created June 13, 2012 21:05
force with link labels
<html>
<head>
<title>Force with Labelled Links</title>
<script src="http://mbostock.github.com/d3/d3.js?2.9.2"></script>
<style type="text/css">
.node {
fill: #88f;
stroke: #44a;
stroke-width: 1px;
}
@donaldh
donaldh / gist:5580373
Created May 14, 2013 22:57
NQP / JVM stack trace
Thread [main] (Suspended (breakpoint at line 73 in Ops))
Ops.print(String) line: 73
<unknown receiving type>(9D98897D001B51184B42A1DC79269461131EE77E).qb_25(ThreadContext, CodeRef, CallSiteDescriptor, Object[]) line: 671
IndyBootstrap.indcallInvoker(MutableCallSite, int, ThreadContext, SixModelObject, Object...) line: 294
<unknown receiving type>(9D98897D001B51184B42A1DC79269461131EE77E).qb_24(ThreadContext, CodeRef, CallSiteDescriptor, Object[]) line: 670
IndyBootstrap.subcallResolve(MethodHandles$Lookup, MutableCallSite, String, int, ThreadContext, Object...) line: 208
<unknown receiving type>(9D98897D001B51184B42A1DC79269461131EE77E).qb_27(ThreadContext, CodeRef, CallSiteDescriptor, Object[]) line: 677
IndyBootstrap.subcallResolve(MethodHandles$Lookup, MutableCallSite, String, int, ThreadContext, Object...) line: 208
<unknown receiving type>(DA6B7A98AB1032C2819A211292826736B32A10CE).qb_10(ThreadContext, CodeRef, CallSiteDescriptor, Object[]) line: 1
IndyBootstrap.indcallInvoker(MutableCa
@donaldh
donaldh / gist:6032692
Created July 18, 2013 20:18
Giving rakudo-debugger a spin on jvm.
% PERL6LIB=lib:../perl6-Term-ANSIColor/lib:../rakudo/install/languages/perl6/lib perl6 bin/perl6-debug.nqp
===SORRY!===
ctxlexpad requires an operand with REPR ContextRef
@donaldh
donaldh / tmpdir.t
Created August 22, 2013 14:46
Proposed TMPDIR spectest
use Test;
plan 3;
ok $*TMPDIR, '$*TMPDIR exists';
ok $*TMPDIR.perl, '$*TMPDIR.perl works';
ok $*TMPDIR.gist, '$*TMPDIR.gist works';
@donaldh
donaldh / Encode.java
Last active December 21, 2015 17:59
Unhelpful behaviour of Java ChsrsetEncoder
package test;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
public class Encode {
@donaldh
donaldh / client_socket.t
Last active December 22, 2015 00:48
A very unscientific socket test.
#! nqp
nqp::readlineintfh(nqp::getstdin(), 'ready?> ');
my $i := 0;
while $i < 100 {
my $fd := nqp::socket();
nqp::connect($fd, 'localhost', 8080);
nqp::sayfh($fd, 'GET /CREDITS HTTP/1.1');
nqp::sayfh($fd, '');
sub robin (Callable $what) {
LEAVE say 'leaving';
$what()
}
sub batman {
robin {
fail "NO";
};
}
@donaldh
donaldh / HashMap
Last active December 23, 2015 18:39
Top 20 from a heap dump of rakudo/jvm after parsing CORE.setting
Class Instance Count Total Size
class org.perl6.nqp.sixmodel.reprs.VMArrayInstance 1357455 43438560
class java.util.HashMap$Entry 1131386 31678808
class [Lorg.perl6.nqp.sixmodel.SixModelObject; 992354 70542912
class [Ljava.util.HashMap$Entry; 851332 127603248
class java.util.HashMap 851212 45114236
class org.perl6.nqp.sixmodel.reprs.VMHashInstance 802197 19252728
class org.perl6.nqp.sixmodel.reprs.P6strInstance 689975 16559400
class [J 642139 75898368
class __P6opaque__22 390551 37492896