Skip to content

Instantly share code, notes, and snippets.

View miklobit's full-sized avatar

MK miklobit

View GitHub Profile
@miklobit
miklobit / aga.json
Last active August 29, 2015 14:02
Działki AGA
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#! /usr/bin/python2
# vim: fileencoding=utf-8 encoding=utf-8 et sw=4
import sys
import os
import xml.etree.cElementTree as ElementTree
import string
outroot = ElementTree.Element("osm", { "version": "0.6" })
bldgroot = ElementTree.parse(sys.argv[1]).getroot()
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<title>Geokoder dla Wiki Lubi Zabytki</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Paweł Marynowski (yarl@o2.pl)">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet">
@miklobit
miklobit / Issues.md
Last active August 29, 2015 14:05 — forked from rclark/Issues.md
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
<?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.