Skip to content

Instantly share code, notes, and snippets.

Avatar

Shan Carter shancarter

View GitHub Profile
View README
Storing images.
View index.html
<h1>This is a Head
<h2>This is an h2
This is an implied p element. It's just like html with significant whitespace.
This is new paragraph.
What about <b>{inline} tags?
And that's about it, although it would allow you to do more complicated stuff.
<h2>More Complicated Stuff
<p.foo>You can add classes to elements.
<div>
View index
h1{This is a Head}
h2{This is an h2}
p{This is an implied p element.}
p{This is another one.}
p{It's just like html but with significant whitespace.}
p{What about b{inline} tags?}
p{And that's about it, although it would allow you to do more complicated stuff.}
h2{More Complicated Stuff}
p.foo{You can add classes to elements.}
@shancarter
shancarter / index.ml15
Last active Jan 6, 2017
Markup Language #15
View index.ml15
h1> This is a Head
h2> This is h2
p> this is a p
p> this is another one
p> It's just like html with significant whitespace.
p> what about {b>inline} tags?
p> And that's about it, although it would allow you to do more complicated stuff.
h2> More Complicated Stuff
p.foo> You can add classes to elements.
@shancarter
shancarter / README.md
Last active Nov 28, 2019
Calculating the relative angle difference between two vectors
View README.md

Here are the math-y bits, courtesy of @ch402:

var a2 = Math.atan2(source.y, source.x);
var a1 = Math.atan2(compare.y, compare.x);
var sign = a1 > a2 ? 1 : -1;
var angle = a1 - a2;
var K = -sign * Math.PI * 2;
var angle = (Math.abs(K + angle) < Math.abs(angle))? K + angle : angle;
@shancarter
shancarter / README.md
Last active Nov 7, 2016
Using d3 to generate canvas png in node.js
View README.md

In order to generate a raster image with d3 in node.js, you need a canvas context. This is a bare bones example of using a node-based canvas for said context.

@shancarter
shancarter / README.md
Last active Jun 7, 2019
Using d3 to generate SVGs in node.js
View README.md

In order to generate some svg with d3 in node.js, you need a dom. This is a bare bones example of using jsdom for said dom.

View article.md

Hello

This is not an article.

@shancarter
shancarter / index.html
Last active Feb 8, 2018
Clustered Force Layout 4.0
View index.html
<!doctype html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script>
let margin = {top: 100, right: 100, bottom: 100, left: 100};
let width = 960,
height = 500,
@shancarter
shancarter / index.html
Last active Feb 18, 2016
Testing data join pattern
View index.html
<!DOCTYPE html>
<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style media="screen">
.child {
margin: 10px 0;
color: white;
}
button {
You can’t perform that action at this time.