Skip to content

Instantly share code, notes, and snippets.

@mzur
mzur / ImageCanvas.js
Created October 24, 2018 12:10
OpenLayers ImageStatic with canvas source
import ImageStatic from 'ol/source/ImageStatic';
import ImageCanvas from 'ol/ImageCanvas';
import EventType from 'ol/events/EventType';
import {listen} from 'ol/events';
class Canvas extends ImageStatic {
constructor(options) {
super(options);
this.image_ = new ImageCanvas(options.imageExtent, 1, 1, options.canvas);
listen(this.image_, EventType.CHANGE, this.handleImageChange, this);
@mzur
mzur / backup-github.sh
Last active April 26, 2021 11:45 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
# https://gist.github.com/mzur/106444b27d09a14d9c164fc44fdeadef
# NOTE: if you have more than 100 repositories, you'll need to step thru the list of repos
# returned by GitHub one page at a time, as described at https://gist.github.com/darktim/5582423
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username); also see the note below about the `REPOLIST` definition around line 48
@mzur
mzur / contact-send.php
Last active September 11, 2015 08:05
Old version of the AJAX response template (http://blog.the-inspired-ones.de/ajax-uniform)
<?php
header::contentType('application/json');
$errors = '';
// check each parameter of the request if it is erroneous
foreach (array_keys(get()) as $field) {
$errors .= $form->hasError($field) ? "\"$field\"," : '';
}
// strip trailing comma
$errors = substr($errors, 0, -1);
@mzur
mzur / README.md
Last active August 29, 2015 14:02
Force layout with labeled links

A simple force layout with labeled links. The labels appear only if the adjacent nodes are hovered.

@mzur
mzur / Control.Button.js
Last active October 10, 2021 16:03 — forked from emtiu/leaflet.button.js
Simple custom Leaflet Control button.
// from https://gist.github.com/emtiu/6098482
// Usage:
// var someButton = new L.Control.Button(options).addTo(map);
// This calls OnAdd(). See the code for what options are required
// The third parameter passed to L.DomEvent.addListener is the 'this' context
// to use in the callback (second parameter).
L.Control.Button = L.Control.extend({
options: {
@mzur
mzur / gedit-with-less-css.md
Last active December 15, 2015 08:39
How to set up gedit with automatic LESS CSS compiling

#How to set up gedit with automatic LESS CSS compiling

##Install the compiler

Install the command line LESS compiler. For example in Ubuntu use sudo apt-get install node-less. Alternatively you can install it using the Node Package Manager sudo atp-get install npm and then npm install -g less for the guaranteed newest version.

Now you are able to compile LESS files using lessc my_less_file.less my_css_file.css but this really sucks if you are setting up the CSS for a new website and have to compile it frequently.

Fortunately there is gedit; the lightweight text editor of your choice ;-)