Skip to content

Instantly share code, notes, and snippets.

@fnicollet
fnicollet / gist:5764080
Created June 12, 2013 09:50
Single tile WMS layer for Leaflet. Kind of hacked on top of ImageOverlay, a new image is requested when the viewport is changed. Supports reprojection through proj4-leaflet There are actually 2 images (_image and _imageSwap) because if you use the _image from ImageOverlay, and set his "src" attribute to the new WMS bbox, your layer will disappea…
goog.provide('L.SingleTileWMSLayer');
goog.require('L.Map');
L.SingleTileWMSLayer = L.ImageOverlay.extend({
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
version: '1.1.1',
# got a huge ammount of help from https://stackoverflow.com/questions/11550153/determine-position-of-number-in-a-grid-of-numbers-centered-around-0-and-increasi
def sequence(i):
n = 2 * i - 1
return n * n
def layer(i):
return math.floor((math.sqrt(i) + 1) / 2)
def length(i):
@csuzw
csuzw / SpiralMemory.cs
Last active December 4, 2017 11:52
Advent of Code 2017 Day 3
int SpiralMemoryPartOne(int location)
{
if (location <= 1) return 0;
var ring = 1;
var max = 9;
while (max < location)
{
ring += 1;
max += (((ring + 1) * 2) - 2) * 4;
@Zverik
Zverik / SingleTile.js
Last active July 4, 2018 12:41
A layer for single-tile WMS layers. Displays a layer as a big picture, updates it on pan and zoom. This is a hack, made for an internal project; still waiting for https://github.com/Leaflet/Leaflet/issues/558 to be solved nicely. Example: L.singleTile('http://irs.gis-lab.info/').setParams({layers: 'landsat'}).addTo(map); (won't work, because tha…
/*
* L.SingleTile uses L.ImageOverlay to display a single-tile WMS layer.
* url parameter must accept WMS-style width, height and bbox.
*/
L.SingleTile = L.ImageOverlay.extend({
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
version: '1.1.1',
@hgomez
hgomez / mint141516.md
Last active October 23, 2018 14:08
Mint 14 -> Mint 15 -> Mint 16

Mint upgrade procedures

Some investigation and tests on how to upgrade Mint machine.

Tests performed on Mint Cinnamon 14/15/16, on physical machine 14->15 and VirtualBox VMs for 14->15->16 and 14->16.

As usual you could break your machine, so please do backups before and cross fingers.

Mint 14 -> Mint 15

@alicebartlett
alicebartlett / Hiring-links.md
Last active November 26, 2018 03:41
A while ago I asked twitter for resources on hiring, here are some links:
# Code borrowed from https://subscription.packtpub.com/book/application_development/9781783984985/1/ch01lvl1sec18/creating-a-standalone-application
# and upgraded for QGIS 3.0
import sys
from qgis.core import (QgsApplication, QgsFeature, QgsGeometry,
QgsProject, QgsVectorLayer)
from qgis.gui import QgsMapCanvas
from qgis.PyQt.QtCore import Qt
# Unused so commented
# from qgis.PyQt.QtGui import *
@AustinDizzy
AustinDizzy / pre-commit
Created July 12, 2015 04:47
A pre-commit git hook that prompts you to automatically `gofmt` Go files staged to commit.
#!/bin/sh
# Modified 2015, Austin Dizzy
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# git gofmt pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
function* runTimer(getState) {
while(yield take('START')) {
while(true) {
const {stop, tick} = yield race({
stop : take('STOP'),
tick : call(wait, ONE_SECOND);
})
if ( !stop ) {
yield put(actions.tick());
var Dialog = React.createClass({
render: function() {
// 1) render nothing, this way the DOM diff will never try to do
// anything to it again, and we get a node to mess with
return React.DOM.div();
},
componentDidMount: function() {
// 2) do DOM lib stuff
this.node = this.getDOMNode();