Skip to content

Instantly share code, notes, and snippets.

@ns-1m
ns-1m / gist:2296532
Created April 4, 2012 00:04
PHP Spatialite to GeoJSON
<?php
/**
* Spatialite to GeoJSON
It needs:
* apache2
* php5-cli
* php5-sqlite
@MikeRogers0
MikeRogers0 / weather-class.inc.php
Created June 16, 2012 17:04
Getting the Weather in PHP
<?php
class Weather {
 public $lat, $long, $weather, $location;
 private $weather_data, $location_data;

 public function __construct($lat=0.0, $long=0.0){
  $this->lat = (float) $lat;
  $this->long = (float) $long;
 }

@chrislkeller
chrislkeller / README.md
Last active December 18, 2020 08:12
SpreadSheet To Fusion Tables

Script to sync a Google SpreadSheet to a Fusion Table

Save for a few legacy projects that still use Fusion Tables I don't actively use this script anymore. This update hopefully solves the OAuth issue that cropped up once Google depcricated the Client Login method used by the prior version.

As always, your mileage may vary, and I welcome someone -- Google or otherwise -- to offer a long-term maintained solution.

The following is largely cribbed from a Google example here. I try to explain some of the API settings that must be enabled in the Developer's Console and elsewhere

Create your spr

@Tomalak
Tomalak / jquery-tablesorter-textextractor.js
Created July 6, 2012 17:11
A custom textExtraction function for jQuery tablesorter that allows better sorting for accented characters and dates in dd.mm.yyyy format. Primarily targeted at German text; might work well for other languages.
// Details: StackOverflow (http://stackoverflow.com/a/614397/18771)
// License: cc-by-sa (http://creativecommons.org/licenses/by-sa/3.0/)
// Extends: jQuery Tablesorter 2.0+ (http://tablesorter.com)
// -------------------------------------------------------------------
// file encoding must be UTF-8!
function getTextExtractor()
{
return (function() {
var patternLetters = /[öäüÖÄÜáàâéèêúùûóòôÁÀÂÉÈÊÚÙÛÓÒÔß]/g;
@iwek
iwek / grab-images-wikipedia.php
Created July 12, 2012 20:38
Retrieve Images from Wikipedia
<?php
/**
* Grab Images from Wikipedia via thier API
*
* @author http://techslides.com
* @link http://techslides.com/grab-wikipedia-pictures-by-api-with-php
*/
//curl request returns json output via json_decode php function
@RandomEtc
RandomEtc / convert.js
Created October 26, 2012 01:13
Simplify GeoJSON using d3-plugins/simplify (thanks @jasondavies for preserving topology!)
// TODO: options parser with overrides for projection, area etc.
if (process.argv.length != 4) {
console.error("usage: node convert.js <input.json> <output.json>");
process.exit(1);
}
require('d3')
require('./node_modules/d3-plugins/simplify/simplify.js')
var fs = require('fs');
@gurdiga
gurdiga / minify-js.sh
Created November 25, 2012 13:34
JS minifying script with curl and Closure Compiler REST API
#!/bin/sh
# Use like this:
#
# minify-js.sh < app.js > app.min.js
#
curl -s \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d output_format=text \
@jpatters
jpatters / HeidiDecode.js
Last active June 19, 2025 12:10
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));
@tmcw
tmcw / xyz_vs_tms.md
Last active May 28, 2025 17:03
The difference between XYZ and TMS tiles and how to convert between them

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.

@peterjaap
peterjaap / navicat_tunnel.php
Created March 13, 2013 12:28
Navicat tunnel file (the nearly unfindable ntunnel_mysql.php)
<?php //version my104
header("Content-Type: application/octet-stream");
error_reporting(0);
set_time_limit(0);
set_magic_quotes_runtime(0);
function phpversion_int()
{
list($maVer, $miVer, $edVer) = split("[/.-]", phpversion());