Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html dir="LTR" lang="de">
<head>
<script type="text/javascript">
/** Disable tracking if the opt-out cookie exists. **/
if (document.cookie.indexOf('optOutPlease=true') > -1) {
/** Opt-Out Cookie set here, no tracking, no Tagmanager **/
}else{
/** Put your Javascript Google Tag Manager code beneath
@vdite
vdite / atrack.php
Last active April 19, 2017 22:14
This Script ist for Offline Conversion Tracking in Google Anylytics. Contact: http://mizine.de
<?php
/**
This Script ist for Offline Conversion Tracking in Google Anylytics
Author: Viktor Dite
Contact: http://mizine.de
Version: v0.2
**/
$uaid = 'UA-XXXXXXX-X'; // Your Analytics UAID
@vdite
vdite / notify-on-new-post.php
Last active March 28, 2024 21:33
Send an email notification to the Wordpress administrator when a new post is published.
<?php
/**
Plugin Name: Alert Admin on new Post
Plugin URI: http://wordpress.stackexchange.com/questions/19040/alert-email-when-any-post-or-page-is-changed
Description: Send an email notification to the administrator when a new post is published.
Author: TheDeadMedic, transfered by Viktor Dite
Version: 1.0
Copyright CC share alike
* @param string $new_status
@vdite
vdite / array_over_get.php
Last active August 28, 2020 09:06
How to transfer an Array over URL GET Parameters
<?php
/* array_over_get.php */
$image_arr=array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg");
$serial_arr=urlencode(base64_encode(serialize($image_arr)));
echo '<img src="process_images.php?arr='.$serial_arr.'" alt="stacked image"/>';
?>
<?php
@vdite
vdite / stack_pngs.php
Last active August 29, 2015 14:01
This GDlib Trick let you stack different transparent png Images to one.
<?php
$image_arr=array('path1.png', 'path2.png', 'path3.png');
echo gd_gen_image($image_arr);
function gd_gen_image($arr){
$base = imagecreatetruecolor(913, 500);
$color = imagecolorallocatealpha($base, 0, 0, 0, 127);
imagefill($base, 0, 0, $color);
@vdite
vdite / jquery-if-file-exist.js
Last active July 20, 2018 22:22
jQuery: how to check if file exists
var base='http://mizine.de';
var url='/image_path_to_test.jpg';
var fallback_url='/image_path_exists_for_fallback_image.jpg';
/** Asynchronous!!! **/
$.get(base+url).done(function(){
$('#any_DOM_id').append('<img id="my_image" src="'+url+'"/>');
}).fail(function(){
$('#any_DOM_id').append('<img id="my_image" src="'+fallback_url+'"/>');
});
@vdite
vdite / ifelse-kurz-javascript.js
Last active August 29, 2015 13:58
if/else Kurzschreibweise in JavaScript
/** normale lange Schreibweise **/
if(omv){
$('select option[value="x"]').remove();
}else{
$('select option[value="x"]').attr('disabled','disabled');
}
/** wesentlich kürzere Schreibweise **/
omv ? $('select option[value="x"]').remove() : $('select option[value="x"]').attr('disabled','disabled');
@vdite
vdite / gist:9922309
Last active August 29, 2015 13:57
Remove disabled select options on iOS devices from DOM to handle mobile safari issues with disabled select options
if(navigator.userAgent.match(/(iPad|iPhone|iPod touch)/i)
&& !navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i)){
$('select.your_special_class option[disabled]').remove();
}
@vdite
vdite / header.php
Last active August 29, 2015 13:57
Manual Twitter Cards and OG Graph Integration in Wordpress Head.php
<?php if ( is_singular() || is_front_page() ) { ?>
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="@YOUR-TWITTER-NAME" />
<meta name="twitter:url" content="<?php the_permalink() ?>" />
<meta name="twitter:title" content="<?php do_action('wpseo_the_title') ?>" />
<meta name="twitter:description" content="<?php do_action('wpseo_the_desc') ?>" />
<meta property="og:title" content="<?php do_action('wpseo_the_title') ?>">
<meta property="og:type" content="article">
<meta property="og:url" content="<?php the_permalink() ?>">
@vdite
vdite / slideshare_datenschutz.html
Created February 18, 2014 17:29
Datenschutzrechtliches Problem mit SlideShare Einbindungen vermeiden
<!-- die folgende Zeile muss gegen den darunter gezeigten Code ersetzt werden -->
<iframe src="http://www.slideshare.net/slideshow/embed_code/28163395" width="577" height="363" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<!-- der folgende Code bewirkt, dass erst nur ein Vorschaubild erzeugt wird. Beim Klick auf das Bild kommt eine Belehrung über die Tracking Mechanismen von SlideShare. Ist der Nutzer einverstanden, wird das Embed von SlideShare nachgeladen. Ist er nicht einverstanden, wird ein Link zum SlideShare Dokument angezeigt -->
<!-- jQuery Variante -->
<div id="slideshare_embed_28163395" class="slideshare_embed" width="577" height="363">
<img id="28163395" src="http://www.aqua-comfort.net/wasserbettwiki/wp-content/uploads/2012/01/medizinische-wasserbett-vorteile.jpg" alt="medizinische wasserbett vorteile" width="577" height="363" class="aligncenter size-full wp-image-2894" />
</div>