Skip to content

Instantly share code, notes, and snippets.

@ingozoell
ingozoell / SassMeister-input-HTML.html
Created April 18, 2014 17:59
Generated by SassMeister.com.
<div class="outer">
<article>
<div class="nest-1">nest-1</div>
<div class="nest-2">nest-2</div>
</article>
<aside>aside</aside>
curl -O http://wordpress.org/latest.tar.gz ; tar -xvzf latest.tar.gz ; mv wordpress/* . ; rmdir wordpress/ ; rm latest.tar.gz ; rmdir wordpress/ ; rm latest.tar.gz ; cp wp-config-sample.php wp-config.php ;
@ingozoell
ingozoell / SassMeister-input-HTML.html
Created April 26, 2014 19:30
Generated by SassMeister.com.
<h1>Headline 1 <span>Headline</span></h1>
@ingozoell
ingozoell / SassMeister-input-HTML.html
Created April 27, 2014 10:09
Generated by SassMeister.com.
<h1>Headline 1 <span>H1 small</span></h1>
<p>Some Text <span>P small</span></p>
@ingozoell
ingozoell / wordpress-user-login.php
Created May 7, 2014 17:17
WordPress User login
function redirect_demo_on_role() {
global $current_user;
get_currentuserinfo();
if( $current_user->user_login == 'demo' OR
$current_user->user_login == 'user.xyz' ) {
{
wp_redirect('http://ingozoell.de/portfolio/'); exit;
}}
}
@ingozoell
ingozoell / retina-modernizr-hidpi-detection.js
Last active May 27, 2017 14:30
Modernizr Retina/HiDPI detection
/* HIDPI Detection ----------------------------------------------- */
var hidpi = 'only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and ( min-device-pixel-ratio: 2), only screen and ( min-resolution: 192dpi), only screen and ( min-resolution: 2dppx)';
if (Modernizr.mq(hidpi)) {
$('html').addClass('hidpi');
}
@ingozoell
ingozoell / clean-up-output-of-stylesheet.php
Created May 8, 2014 20:24
Clean up output of stylesheet
/*
------------------------------------------------------------------------------------------
Clean up output of stylesheet <link> tags
------------------------------------------------------------------------------------------ */
function my_clean_style_tag($input) {
preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!", $input, $matches);
// Only display media if it is meaningful
$media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : '';
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
}
@ingozoell
ingozoell / resize-modernizer-mq-detection.js
Last active March 13, 2016 12:06
Resize Modernizr Media queries detection
/* http://jsperf.com/bind-to-ready-and-resize/2 */
$(document).ready(function() {
$(function mq_detection() {
$(window).resize(function() {
if(Modernizr.mq('only screen and (max-width:600px)')) {
} else {
<Files *.xls>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>
<Files *.eps>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>
@ingozoell
ingozoell / protected-private-uploads-wp.txt
Created June 18, 2014 09:28
WP – Protected private uploads (*-inter.*)
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteCond %{REQUEST_URI} ^.*assets/.*
RewriteCond %{REQUEST_FILENAME} ^.*-intern.(jpg|jpeg|gif|bmp|png|pdf)$
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule . /wp-login.php?redirect_to=%{REQUEST_URI} [R,L]
</IfModule>