Skip to content

Instantly share code, notes, and snippets.

View miklobit's full-sized avatar

MK miklobit

View GitHub Profile
@miklobit
miklobit / index.html
Last active December 29, 2015 07:49 — forked from gijs/index.html
<html>
<head>
<title>Testing d3.js in Leaflet.js</title>
<link rel="stylesheet" href="leaflet.css" />
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js?2.9.3"></script>
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<style type="text/css">
import urllib
import urllib2
import os.path
from lxml import etree
import string
def output_node(node, message):
link = e.attrib['v'].encode('utf-8')
link = link.replace("pl:", "")
print
@miklobit
miklobit / 0_reuse_code.js
Created April 4, 2014 00:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
L.Control.Button = L.Control.extend({
options: {
position: 'bottomleft'
},
initialize: function (options) {
this._button = {};
this.setButton(options);
},
@miklobit
miklobit / index.html
Created May 1, 2014 08:06 — forked from biovisualize/index.html
Download svg generated from D3
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>Download SVG</title>
<style type="text/css">
#download{
cursor: pointer;
text-decoration: none;
color: black;
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>Download SVG</title>
<style type="text/css">
a{
cursor: pointer;
text-decoration: underline;
color: black;

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

#! /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.