Skip to content

Instantly share code, notes, and snippets.

@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>
@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 / 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 / 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 / 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 / Redirectmatch with regEx
Created June 12, 2013 11:26
Redirectmatch some URL Parts
Redirectmatch 301 ^/song((s)|(writer))(\/){0,1}(\.htm){0,1}(l){0,1}$ http://tld/songs.html
@vdite
vdite / traffic analyser
Created June 18, 2013 13:52
ethernet packet analyser monitor network activity
tcpdump -i [interface, en0 is ethernet, en1 is wireless]
@vdite
vdite / Javascript console debugging
Created June 18, 2013 19:59
Javascript console debugging - don't use just console.log(); - it fails on IE Make sure, console is defined
if(console!="undefined"){console.log('myLog');}
@vdite
vdite / redirect old site to new domain
Created June 27, 2013 21:09
Redirect an old domain and all the old sites to a new domain
#this redirects all your old stuff to the main site of the new domain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old-domain.com [NC]
RewriteRule ^(.*)$ http://new-domain.com/ [L,R=301]
RewriteCond %{HTTP_HOST} ^www.old-domain.com [NC]
RewriteRule ^(.*)$ http://new-domain.com/ [L,R=301]
#this redirects all your old stuff to the new domain, leaving all deep urls like before
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old-domain.com [NC]
@vdite
vdite / jQuery: Collapse iframe if empty
Created June 28, 2013 09:55
Collapse iframe if empty with jQuery
// if you are using no caching headers in your iframe sources, so you 'll always get an "filled" iframe. This does kick your layout sometimes.
// this is how to coollapse such iframes:
if($("#iframeid").contents().find("p").length) {
$('#iframeid').css('display', 'none');
}
// this is how to kill all caches in the iframe source
// <head>
// <meta http-Equiv="Cache-Control" Content="no-cache">