Skip to content

Instantly share code, notes, and snippets.


Peter Hankiewicz peter-hank

View GitHub Profile
peter-hank / gist:4049962c8ccd3abefa42e58bdd4a5266
Created Jan 10, 2018
Reddit multi-upvote for Greasemonkey
View gist:4049962c8ccd3abefa42e58bdd4a5266
// ==UserScript==
// @name Reddit multi-upvote
// @description Upvotes submissions and comments
// @include*
// @include*
// @version 1
// @grant none
// ==/UserScript==
// submissions only
peter-hank /
Created Nov 1, 2017 — forked from wernight/
inotifywait helper that executes a command on file change (for Linux, put it in ~/bin/)
#!/usr/bin/env python
"""Use inotify to watch a directory and execute a command on file change.
Watch for any file change below current directory (using inotify via pyinotify)
and execute the given command on file change.
Just using inotify-tools `while inotifywait -r -e close_write .; do something; done`
has many issues which are fixed by this tools:
* If your editor creates a backup before writing the file, it'll trigger multiple times.
* If your directory structure is deep, it'll have to reinitialize inotify after each change.
View gist:4900bf94e8b48e1f39739e014d242d34
View sync_json.html
function loadTextFileAjaxSync(filePath, mimeType) {
var xmlhttp=new XMLHttpRequest();"GET",filePath,false);
if (mimeType != null) {
if (xmlhttp.overrideMimeType) {
peter-hank / magento-1.9-patch-sorted-attribue-options
Created Jan 5, 2016
Sort product attribute options by the position property in Magento patch
View magento-1.9-patch-sorted-attribue-options
From 7423c3fd53926f4e8dac9ab9a4b4f65b94eaa7f7 Mon Sep 17 00:00:00 2001
From: peter-hank <>
Date: Tue, 5 Jan 2016 20:11:19 +0100
Subject: [PATCH] Update Collection.php
.../Product/Type/Configurable/Attribute/Collection.php | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
peter-hank / Collection.php
Created Jan 5, 2016
Sort product attribute options by the position property in Magento (app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php)
View Collection.php
* Magento
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: