Skip to content

Instantly share code, notes, and snippets.

@peta
peta / Vendor prefixed property
Created September 25, 2010 16:01
After you triggered the snippet, just type the desired property in its generic form and it will be mirrored into vendor prefixed properties for Mozilla Gecko, Webkit, Opera and Internet Explorer.
${1:}: ${2:};
-moz-${1/\s.*//}: $2;
-webkit-${1/\s.*//}: $2;
-o-${1/\s.*//}: $2;
-ms-${1/\s.*//}: $2;$3
@peta
peta / fm4-grabber.sh
Created March 12, 2011 00:04
Tool for batch downloading FM4 podcasts
#!/usr/bin/env bash
# Author: Peter Geil -- @pbyte
# Version: 0.1
# Description: Tool for batch downloading <http://fm4.orf.at> podcasts.
DIRECTORY=$(cd `dirname $0` && pwd)
if [ $(($#)) -gt 0 ]; then
URL=$1
@peta
peta / sniff_file.sh
Created May 13, 2011 11:46
Sniff type of files by scanning their contents
#!/usr/bin/env sh
# A simple one-liner
find . -depth 1 -type f -name "*.pdf" -exec file {} \;
@peta
peta / ftat-mousehover5k.jquery.js
Created July 15, 2011 22:22
Filmtipps.at Mousehover5000
/**
*
* Filmtipps.at Mouseover5000(tm)
*
* Author: Peter Geil
* Created: 15.07.11
* License: to kill
* Description: When hovering a movie entry, the corresponding film poster will
* be highlighted and vice versa. The code is written for the document/markup model
* Filmtipps.at is using right now (15.07.11)and might break when they change it. My intention
@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 }