Skip to content

Instantly share code, notes, and snippets.

View ginsterbusch's full-sized avatar

Fabian Wolf ginsterbusch

View GitHub Profile
@ginsterbusch
ginsterbusch / str_in_array.php
Created July 18, 2012 07:09
Replacement for in_array (for string searches only)
<?php
/**
* @author Fabian Wolf
* @version 0.2
* @license LGPL
* @link http://usability-idealist.de/
*/
if( !function_exists('str_in_array') ) {
@ginsterbusch
ginsterbusch / charset-test.php
Created July 20, 2012 17:00
HTTP header charset test
<?php
/**
* Quick character set test
* Simply comment out the HTTP header you DO NOT want to use
*/
header('Content-Type: text/html; charset=iso-8859-1'); // breaks the charset
header('Content-Type: text/html; charset=utf-8'); // correct charset
?>
<html>
@ginsterbusch
ginsterbusch / liberate-tute-me-ex-inferis.html
Created November 28, 2012 19:39
well-formed HTML text
<div id="intro" style="font-size:medium;text-align: right; color:#000; font-style: italic">
<p>different. impulsive. emotional. rhetorician. always in company but still lonely. music-fetishist. shy. loud. adapted unadapted. creative. relaxed. chaotic. vocalist without talent. black dressed. complicated. contemplative. headbanger. annalist. idiosyncratic. optimistic. lazy. impertinent. pleasant. sun-phobic. pierced. late riser. tattoo-fetishist. loves music-festivals. lovingly. sensual. adventurous. womanly. spontaneously. headless. self-destructive. chocolate-addicted. luxurious. dislikes phone-calls. addiction to pleasure. heartfelt. do-gooder. rebellious. profound. keen thinker. unique. likable. broad-minded. ironic.</p>
</div>
<div id="rant" style="font-style:italic; margin-top: 50px;">
@ginsterbusch
ginsterbusch / subtlepatterns-api.php
Created December 5, 2012 02:25
Quick hack of a rudimentaty "API" for subtle-patterns.com
<?php
/**
* WP nastyness with Subtle Patterns for a extremely simplistic "API"
*
* æauthor Fabian Wolf
* @link http://usability-idealist.de/
*/
// bootstap WP framrework
require_once('../../../wp-config.php'); // assuming this file is sitting in some sub directory like wp-content/theme/my-theme/
@ginsterbusch
ginsterbusch / gist:4630881
Created January 25, 2013 01:43
smarty template to test whether modifiers are allowed to be used in if-else-clauses or not.
{assign var="strPreis" value='133,00'}
<html>
<head>
<title>formatting test</title>
</head>
<body>
<p>replacement test: {if $strPreis|replace:',':'.' == '133.00'}
works!
{else}
fucks up .. as usual.
@ginsterbusch
ginsterbusch / style-improved.css
Created February 6, 2013 17:29
better readability for blog.nora-schwarz.de. => should result in this: http://gfx.fwwd.de/screenshots/nora-blog-better-css.jpg (green outlined area)
.entry {
color: #ddd;
font-family: Georgia,"Century Schoolbook L",Garamond,serif;
font-size: 1.1em;
line-height: 1.4em;
text-align: justify;
text-indent: 1.5em;
padding-left: 25px;
padding-right: 25px;
@ginsterbusch
ginsterbusch / happy-stabbing-in-the-dark.php
Created May 16, 2013 08:39
Capri Fishn bzw. im Trüben fischen ... Dinge, denen man so als Entwickler täglich begegnet. In anderer Leute Quelltext vor allen Dingen. Capri Fish - or: to stab in the dark .. Stuff you, as a developer, stumble upon daily, esp. in the source code committed by OTHER people.
function get_table_head( $col, $mode = 'desc' ) {
$return = '';
$link = '';
$amp = '&';
$equal = '=';
$link .= '?bereich='.$_GET['bereich'];
foreach($_GET as $key => $value){
if($value == "desc"){
@ginsterbusch
ginsterbusch / pdf-download-test.php
Last active December 18, 2015 21:49
PDF Download test
<?php
/**
* PDF download test
*
* @author Fabian Wolf
* @link http://usability-idealist.de/
*
* NOTE: Copy + paste from @link http://www.php.net/manual/de/function.header.php#refsect1-function.header-examples
*/
@ginsterbusch
ginsterbusch / custom-comment-fields-snippet.php
Created July 29, 2013 08:41
Enable custom fields for the WordPress comments only for pages/posts with a specific custom field key and value. Quick'n'dirty copy + paste out of a plugin I've been working on (also see the debug inserts) ;) In this case, the custom meta field key is $this->pluginPrefix . 'page' = participant_list_page (that should already tell you what I'm aim…
function is_participant_page() {
global $post;
$return = false;
$arrDebug = array(
'post' => $post,
);
// check custom field
$strIsParticipantsPage = get_post_meta( $post->ID, $this->pluginPrefix . 'page', true );
@ginsterbusch
ginsterbusch / how-to-NOT-do-if-clauses.php
Last active December 22, 2015 13:49
Nasty piece I fouund in an officially "customized" part of a WordPress theme - just when I thought I've seen it all .. m(
<?php
if($parentCatName=='Kunden'):{
?>
<p class="agency" style="color: #00ffff;">
<?php echo "AGENCY";?>
</p>
<?php
}
else:{
?>