Skip to content

Instantly share code, notes, and snippets.

@peta
peta / weirdo-char-stripper.sh
Created July 26, 2011 15:07
weirdo-char-stripper
#!/usr/bin/env bash
if [ $(($#)) -gt 0 ]; then
cwd=$1
else
cwd=`pwd`
fi
cd "$cwd"
@peta
peta / pipe-ajax-endpoint.php
Created September 5, 2011 21:03
Proof of concept: Piped AJAX polling
<?php
// This script's purpose is to echo some distinguishable dummy values
// Dummy values
$known_resources = array(
'resource1' => 'News',
'resource2' => 'Status',
'resource3' => 'Images',
'resource4' => 'Messages',
@peta
peta / class.events.inc.php.diff
Created October 7, 2011 13:30
Fix for CMSMS 1.9.4.3 event propagation system; enable propagation to originator module
--- class.events.inc.php
+++ (clipboard)
@@ -99,9 +99,10 @@
* @param string $modulename The name of the module that is sending the event
* @param string $eventname The name of the event
* @param array $params The parameters associated with this event.
+ * @param boolean $exclude_originator Don't propagate event to originator module
* @return void
*/
- static public function SendEvent( $modulename, $eventname, $params = array() )
@peta
peta / 960gridder.js
Created March 30, 2012 13:51
Slightly improved version of 960gridder. Now the overlay won't catch pointer events anymore, meaning that the overlay can stay visible while working on the DOM/CSS.
/*
* Release: 1.3.1 2009-04-26
*/
/*
* Copyright (c) Andr?e Hansson (peolanha AT gmail DOT com)
* MIT License - http://www.opensource.org/licenses/mit-license.php
* Idea loosely based on JASH, http://billyreisinger.com/jash/
*
* Website: http://gridder.andreehansson.se/
*
@peta
peta / readme.md
Created April 27, 2012 16:23
D7: Quick'n'dirty bulk import for article nodes

During several relaunches I had to migrate thousands of content items (mostly news articles) from Typo3 (WTF?!??) sites to the new (Drupal-based) ones. Because Drupal's Bulk Import API or the Feeds module seemed way to overdose, I decided to accomplish that using only MySQL's toolbelt: Stored Procedures.

Usage

CALL do_batch_import(0, 1000);

@peta
peta / qrencode.c
Created July 11, 2012 13:11
qrencode.c
/* $ Id: $ */
#include "php_qrencode.h"
#if HAVE_QRENCODE
/* {{{ qrencode_functions[] */
function_entry qrencode_functions[] = {
PHP_FE(qrencode , NULL)
{ NULL, NULL, NULL }
@peta
peta / redirect_german.po
Created August 22, 2012 12:34
[D7] German translation of Redirect module
# $Id$
#
# LANGUAGE translation of Drupal (general)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# redirect.admin.inc: n/a
# views/redirect.views.inc: n/a
# redirect.module: n/a
# views/redirect_handler_field_redirect_link_edit.inc: n/a
# views/redirect_handler_field_redirect_operations.inc: n/a
@peta
peta / fbsdk-php_kohana-session-fix.patch
Created September 15, 2012 14:35
Small fix that prevents session data from getting corrupted when the Facebook PHP SDK is used within Kohana
Index: src/application/vendor/facebook-sdk/src/facebook.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/application/vendor/facebook-sdk/src/facebook.php (revision )
+++ src/application/vendor/facebook-sdk/src/facebook.php (revision )
@@ -106,7 +106,7 @@
}
@peta
peta / mysql-mirror.sh
Created December 13, 2012 15:56
Simple bash script for migrating MySQL databases (including all associated user accounts) to a remote server. Use it with care because the usage of mysqldump in this script solely relies on default values which may vary greatly on your machine. (mysqldump is a powerful tool, so don't miss `man mysqldump`).
#!/bin/bash
# Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# Source: http://www.cyberciti.biz/tips/move-mysql-users-privileges-grants-from-one-host-to-new-host.html
# Author Vivek Gite <vivek@nixcraft.com>,
# Peter Geil <code@petergeil.name>
# ------------------------------------------------------------
# SETME First - local mysql user/pass
_lusr="src-db-user"
_lpass="src-db-pw"
@peta
peta / isnexusinstock.cron
Last active December 10, 2015 14:38
Cronjob der alle 30 Minuten die Verfügbarkeit der Google Nexus 10 Tablets im Google-Play-Store prüft und – wenn lieferbar – eine Benachrichtigungs-Mail an eine gegebene Adresse verschickt. `crontab isnexusinstock.cron`
*/30 * * * * /path/to/your/isnexusinstock.sh