Skip to content

Instantly share code, notes, and snippets.

View miklobit's full-sized avatar

MK miklobit

View GitHub Profile
<?php
// Watermark with Imagick
// load images
$image = new Imagick("image.jpg");
$watermark = new Imagick("watermark.png");
// translate named gravity to pixel position
$position = gravity2coordinates($image, $watermark, 'lowerRight', 5, 5);
// compose watermark onto image
@miklobit
miklobit / index.html
Created September 17, 2014 05:44 — forked from mbostock/.block
D3 - align text to path
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v2.js"></script>
<script>
var svg = d3.select("body").append("svg")
.attr("viewBox", "0 0 500 300");
svg.append("defs").append("path")
@miklobit
miklobit / index.html
Last active August 29, 2015 14:06 — forked from methodofaction/index.html
D3 + Make element follow the path
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
#line{
width: 100%;
margin: 20px 0;
height: 300px;
background: #eee;
@miklobit
miklobit / index.html
Created September 17, 2014 15:24 — forked from mbostock/.block
Point-Along-Path Interpolation
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Point-Along-Path Interpolation</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.4.6"></script>
<style type="text/css">
path {
cursor: pointer;
@miklobit
miklobit / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

Click to add new points. Hit the DELETE key to remove the selected point. Use the dropdown menu to change the interpolation mode.

@miklobit
miklobit / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

This globe rotates along φ (latitude) and then along λ (longtitude). Normally, the axes are rotated in the opposite order. D3’s new geometry pipeline allows multiple rotations to be applied sequentially, allowing you to specify the desired order.

@miklobit
miklobit / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block
@miklobit
miklobit / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

This stylized globe uses D3’s in-development geometry pipeline to jitter points before rendering. Points are sampled along great arcs, jittered, and then smoothed using basis-spline interpolation to achieve a hand-drawn effect. The resulting spherical geometry is computed once, allowing faster rendering with arbitrary rotation!

This techinque was developed in collaboration with Derek Watkins for Norway the Slow Way.

@miklobit
miklobit / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

This animation shows the branching process of Bridson’s Poisson-disc sampling algorithm. Each time a new sample is added, a line is drawn between the new sample and the neighboring sample that spawned it.

@miklobit
miklobit / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

Another variation of color-cycling a spanning tree generated by Prim’s algorithm. Here the periodicity of the color scale by tree depth is varied over time, alternating between emphasis of micro and macro structure. This idea was suggested in a Hacker News comment.