Skip to content

Instantly share code, notes, and snippets.

View tormi's full-sized avatar
🇪🇪
Working from home

Tormi Tabor tormi

🇪🇪
Working from home
View GitHub Profile
<?php
/**
* Implements hook_menu().
*/
function example_api_menu() {
$items = array();
$items['api'] = array(
'page callback' => 'example_api_redirect',
'page arguments' => array(1, 2),
<?php
$headers = array();
foreach ($xml->ROW->children() as $field) {
$headers[] = $field->getName();
}
$csv_filename = str_replace('xml', 'csv', $filename);
$file = $this->getCsvDirectory() . '/' . $csv_filename;
if (file_exists($file)) {
<?php
/**
* Write JSON encoded data to disk.
*/
protected function writeJson($filename, $data) {
if (!file_exists($this->getJsonDirectory())) {
if (!drush_mkdir($this->getJsonDirectory())) {
return drush_set_error('NO_JSON_DIR', dt('Unable to create JSON directory at !file', array('!file' => $this->getJsonDirectory())));
}
}
<?php
/**
* Read a CSV file.
*/
public function readCSV($file) {
$data = array();
if (file_exists($file)) {
$file_handle = fopen($file, 'r');
while (!feof($file_handle)) {
@tormi
tormi / keskkonnainfo.geojson
Created January 27, 2014 09:21
register.keskkonnainfo.ee
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tormi
tormi / lasteaiad.geojson
Last active January 4, 2016 00:19
Tallinna lasteaiad
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tormi
tormi / kihelkonnad_1922.geojson
Last active December 30, 2015 08:39
Kihelkonnad 1922
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tormi
tormi / maakonnad_1938.geojson
Last active December 29, 2015 23:09
Maakonnad 1938
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tormi
tormi / rajoonid_1989.geojson
Last active December 29, 2015 23:09
Rajoonid 1989
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers MBTiles Example</title>
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css" type="text/css">
<style>