Skip to content

Instantly share code, notes, and snippets.

View jeremypage's full-sized avatar

Jeremy Page jeremypage

  • Trafford Council
  • UK
View GitHub Profile
@jeremypage
jeremypage / google-analytics-extras.js
Last active October 8, 2018 16:50
Enable tracking of many links and downloads that cannot normally be tracked in Google Analytics (from http://www.blastam.com/blog/index.php/2013/03/how-to-track-downloads-in-google-analytics-v2)
// Enables us to track many links and downloads that cannot normally be tracked in Google Analytics
jQuery(document).ready(function($) {
var filetypes =
/\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|txt|rar|wma|mov|avi|wmv|flv|wav)$/i;
var baseHref = '';
if (jQuery('base').attr('href') != undefined) baseHref = jQuery(
'base').attr('href');
jQuery('a').on('click', function(event) {
var el = jQuery(this);
@jeremypage
jeremypage / gdal-cheat-sheet.md
Created February 7, 2015 07:08
Cheat sheet for GDAL/OGR command-line tools (from https://github.com/dwtkns/gdal-cheat-sheet)

Cheat sheet for GDAL/OGR command-line geodata tools

Vector operations

Get vector information

ogrinfo -so input.shp layer-name

Or, for all layers

@jeremypage
jeremypage / connected-users.sql
Created February 6, 2015 15:27
Query connected users on SQL Server databases
SELECT @@ServerName AS SERVER
,NAME
,login_time
,last_batch
,getdate() AS DATE
,STATUS
,hostname
,program_name
,nt_username
,loginame
@jeremypage
jeremypage / TAB2geoJSON.cmd
Last active June 13, 2022 01:20
Convert all MapInfo TAB files in folder to geoJSON (change projection from British National Grid to Longitude / Lattitude WGS84)
for /r %i in (*.TAB) do ogr2ogr -f "GeoJSON" %i.geojson %i -s_srs EPSG:27700 -t_srs EPSG:4326
@jeremypage
jeremypage / ogr2ogr.cmd
Created February 3, 2015 12:46
ogr2ogr: Convert MapInfo TAB file to geoJSON (British National Grid projection)
ogr2ogr -f "GeoJSON" -a_srs "EPSG:27700" output.geojson input.TAB
@jeremypage
jeremypage / web.config.xml
Last active March 11, 2020 15:35
IIS web.config: Redirect all traffic to HTTPS
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
@jeremypage
jeremypage / ThisPageHasNowMoved.html
Last active August 29, 2015 14:12
'This Page Has Now Moved' redirect page template for Trafford Council websites
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7">
<![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8">
<![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9">
<![endif]-->
@jeremypage
jeremypage / Notepad++_MapBasic.xml
Created October 27, 2014 09:09
MapInfo MapBasic syntax for Notepad++
<NotepadPlus>
<UserLang name="MapBasic" ext="mb MB tab TAB wor WOR def DEF" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03 04 00&apos; 01 02</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@jeremypage
jeremypage / TrelloProjectTracking.js
Last active April 17, 2020 18:11
Project progress tracking with Google Sheets and Trello
// Original code and guide from Kevin Pelgrims
// (http://kevinpelgrims.com/blog/2012/03/06/project-progress-tracking-with-google-docs-and-trello)
// Create a new Google Sheet and add this code in Tools-->Script editor
// Then create trigger (under Resources menu) to run automatically, if you want
// Main function. Call this first (and from any triggers).
// (Revised functionality provided by anonymous commenter)
function getTrelloListCounts() {
var data;
//topBuffer is the distance from the top of the document to where we want to
@jeremypage
jeremypage / True Trello Printer.html
Last active August 29, 2015 14:08 — forked from mathiasrw/True Trello Printer
Formats Trello JSON export into a web-friendly, printer-friendly view
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>True Trello Printer</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<style>
body{margin:15%;}
.panel-body{