Skip to content

Instantly share code, notes, and snippets.


Gregor Aisch gka

Block or report user

Report or block gka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
johnkolbert / gist:769160
Created Jan 7, 2011
Unregisters a post type and removes the menu item
View gist:769160
* Usage for a custom post type named 'movies':
* unregister_post_type( 'movies' );
* Usage for the built in 'post' post type:
* unregister_post_type( 'post', 'edit.php' );
function unregister_post_type( $post_type, $slug = '' ){
paulirish / rAF.js
Last active Feb 26, 2020
requestAnimationFrame polyfill
View rAF.js
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
drewjoh / custom.js
Created Jan 27, 2012
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
View custom.js
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
} else {

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

migurski /
Created Apr 25, 2012
Polygonize a bag of lines
from sys import argv
from shapely.ops import polygonize
from shapely.geometry import asShape, LineString
import json
if __name__ == '__main__':
input = argv[1]
input = json.load(open(input))
jarek-foksa / gist:2648095
Last active Aug 5, 2017
SVGElement.prototype.innerHTML shim
View gist:2648095
// Important: You must serve your pages as XHTML for this shim to work,
// otherwise namespaced attributes and elements will get messed up.
Object.defineProperty(SVGElement.prototype, 'innerHTML', {
get: function() {
var $child, $node, $temp, _i, _len, _ref;
$temp = document.createElement('div');
$node = this.cloneNode(true);
_ref = $node.children;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
$child = _ref[_i];
gka /
Created Jan 24, 2013
PHP Endpoint for Github Webhook URLs

PHP Endpoint for Github Webhook URLs

If you love deploying websites using Github, but for some reason want to use your own server, this script might be exactly what you need.

  1. Put github.php somewhere on your PHP-enabled web server, and make it accessible for the outside world. Let's say for now the script lives on
pudo / nomenklatura.sql
Created Feb 19, 2013
Postgres Nomenklatura Client
View nomenklatura.sql
CREATE OR REPLACE FUNCTION nomenklatura (key text, dataset text, api_key text)
AS $$
import json, urllib, urllib2
url = '' % dataset
url += urllib.urlencode({'api_key': api_key, 'key': key})
req = urllib2.Request(url, None, {'Accept': 'application/json'})
View gist:5040571
dayLength = 24 * 60 * 60 * 1000
beforeMidnight = (dayLength - 1)
endDate = (year, month, day) ->
date = new Date(year, parseInt(month or 1)-1, day or 1)
return new Date(date.getTime() + beforeMidnight)
exports.parseDate = (dateString) ->
yanofsky /
Created Mar 7, 2015
How to Make a gif from a folder of images
# requirement! install imagemagick
# brew install imagemagick
# or build from source here
#navigate to folder of the images
cd folderofmyimages/
# take every jpg in the folder and smash into a gif with a frame rate of 0.5 sec
convert -delay 50 *.jpg gif_of_my_images.gif
You can’t perform that action at this time.