Skip to content

Instantly share code, notes, and snippets.

View yohanboniface's full-sized avatar
💭
Set your status

Yohan Boniface yohanboniface

💭
Set your status
View GitHub Profile
var request = require("request"),
mapnik = require('mapnik'),
zlib = require('zlib');
request({
uri: "http://vector.mapzen.com/osm/all/17/66388/45097.mvt",
// uri: "http://carto.data.gouv.fr/vector/all/17/66386/45096.mvt",
encoding: null
}, function(error, resp, body) {
var info, compression;
— HOT
* Building digitizing
building => yes
source => …
note => …
* Building features
building
building:levels
building:material
building:roof
# -*- coding: utf-8 -*-
import pytest
def smart_struncate(s, length=100, suffix='…'):
# Be smart here.
return s
@pytest.mark.parametrize('given,expected,length,suffix', [
[u'Ceci est une longue phrase qui pourrait éventuellement servir de titre à billet de blog mais est vraiment beaucoup trop longue', # noqa
u'Ceci est une longue phrase qui pourrait éventuellement servir de titre à billet de blog mais est…', None, None], # noqa
@yohanboniface
yohanboniface / gist:a00c1c818a40920ab222
Created July 8, 2015 12:38
Kosmtik localconfig for osm-bright
/* globals exports */
exports.LocalConfig = function (localizer, project) {
localizer.where('Layer').if({'Datasource.type': 'postgis'}).then({
'Datasource.dbname': 'idf',
'Datasource.password': '',
'Datasource.user': 'ybon',
'Datasource.host': ''
});
localizer.where('Layer').if({id: 'ne_places'}).then({'Datasource.file': '/home/ybon/Code/maps/osm-bright/osm-bright/data/ne_places/10m-populated-places-simple.shp'});
};
{
"env": {
"browser": true,
"node": true
},
"rules": {
"quotes": "single",
"indent": [2, 2]
}
}
import csv
import json
import time
from addok.import_utils import FIELDS
def main(filepath, destination, limit=None):
print('Processing', filepath)
@yohanboniface
yohanboniface / gist:7e6f7bfe72fde415dbc5
Created December 20, 2014 22:15
Unique words in BANO corpus
This file has been truncated, but you can view the full file.
5 Aa
2 AA/13
1 Aade
1 Aaison
1 Aalmatt
24 Aalto
1 Aaouats
4 Aar
5 Aaro
133 Aaron
@yohanboniface
yohanboniface / localconfig.js
Created September 29, 2014 17:32
Example of Kosmtik localconfig files used for HDM rendering
exports.LocalConfig = function (localizer, project) {
var country = 'burundi',
centers = {
hispaniola: [-71.7325, 19.1075, 9],
burundi: [29.9377, -3.4216, 9],
sierraleone: [-13.2366965, 8.4732210, 9],
chad: [16.56874, 8.68063, 9],
mauritania: [-11.558, 19.725, 9]
};
project.mml.compareUrl = "http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
{
"cache": {
"name": "Disk",
"path": "/var/cache/stache"
},
"layers": {
"hdm": {
"provider": {
"name": "mapnik",
"mapfile": "/home/ybon/src/hdm/hdm/mapnik.xml",