Skip to content

Instantly share code, notes, and snippets.

View ka7eh's full-sized avatar

Kaveh Karimi-Asli ka7eh

View GitHub Profile
@ka7eh
ka7eh / loadDependencies.js
Created November 19, 2016 22:37
Dynamic loading of js and css dependencies in DOM
function loadDependencies(deps, callback) {
var dep = deps.shift();
if (dep['script'] && typeof(window[dep['lib']]) != dep['loadType'] || 'function') {
var depScript = document.createElement('script');
depScript.type = 'text/javascript';
depScript.src = dep['script'];
(document.getElementsByTagName('head')[0]).appendChild(depScript);
}
@ka7eh
ka7eh / 01_tilemaker.py
Last active August 1, 2016 18:45
A simple tile maker, using mapnik and mercantile
"""
requires:
- mapnik 3.x and its python bindings (https://github.com/mapnik/mapnik)
- mercantile==0.9.0 (https://github.com/mapbox/mercantile)
"""
import os
import mapnik
import mercantile
@ka7eh
ka7eh / leaflet_to_pdf.html
Created April 12, 2016 16:55
An example for converting Leaflet maps to PDF using leaflet-image and jsPDF
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"/>
<style>
#mapid{
height: 480px;
}
#download {
position:absolute;