Skip to content

Instantly share code, notes, and snippets.

@mzur
mzur / ImageCanvas.js
Created Oct 24, 2018
OpenLayers ImageStatic with canvas source
View ImageCanvas.js
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 Apr 26, 2021 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
View backup-github.sh
#!/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 Sep 11, 2015
Old version of the AJAX response template (http://blog.the-inspired-ones.de/ajax-uniform)
View contact-send.php
<?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 Aug 29, 2015
Force layout with labeled links
View README.md

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

@mzur
mzur / Control.Button.js
Last active Oct 10, 2021 — forked from emtiu/leaflet.button.js
Simple custom Leaflet Control button.
View Control.Button.js
// 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 Dec 15, 2015
How to set up gedit with automatic LESS CSS compiling
View gedit-with-less-css.md

#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 ;-)