Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
2ndkauboy / _respond-to-ie.scss
Last active October 13, 2015 00:28
A simple mixin that takes a target size and adds a min-width media query and a IE fallback given by a variable for the content.
@mixin respond-to-ie($size){
@if $old-ie {
@content;
} @else {
@media all and (min-width: $size) {
@content;
}
}
}
@2ndkauboy
2ndkauboy / _animation.scss
Last active December 12, 2015 00:19
A simple mixins to use CSS3 anmiations in SASS with all vendor prefixes and the possibility to set any specific animation property.
@mixin animation($value) {
-webkit-animation: unquote($value);
-moz-animation: unquote($value);
-o-animation: unquote($value);
animation: unquote($value);
}
@mixin animation-property($property, $value) {
-webkit-animation-#{$property}: unquote($value);
-moz-animation-#{$property}: unquote($value);
@2ndkauboy
2ndkauboy / _pixelratio.scss
Last active December 16, 2015 07:18
A simple mixin to wrap some CSS into a pixel-ration media query
@mixin pixel-ratio($ratio){
@media (-webkit-min-device-pixel-ratio: $ratio), /* Webkit browsers */
(min--moz-device-pixel-ratio: $ratio), /* old Firefox (prior to FF 16) */
(min-resolution: #{$ratio}dppx), /* the standard using dppx */
(min-resolution: #{$ratio * 96}dpi){ /* fallback using dpi */
@content;
}
}
@2ndkauboy
2ndkauboy / _background_image_hidpi.scss
Last active December 16, 2015 07:19
A simple mixin to use a different background images for HiDPI devices.
@mixin background-image-hidpi($normalImage, $hdpiImage, $ratio){
// normal image
background-image: url('#{$normalImage}');
// high dpi image
@include pixel-ratio($ratio){
background-image: url('#{$hdpiImage}');
}
}
// This mixin uses the mixin pixel-ratio() which you can find in anoter gist: https://gist.github.com/2ndkauboy/5397402
<?php
/**
* Search the array for a part of a string in the values and return an array with matching elements
*
* @param array $haystack The array.
* @param string $needle The searched value.
* @return array The filtered array.
*/
function array_match_string(array $haystack, $needle){
@2ndkauboy
2ndkauboy / ajax-deactivation-contact-form-7.php
Last active December 20, 2015 11:28
Deactivate the JS functionality of Contact Form 7
<?php
/*
Plugin Name: AJAX Deactivation for Contact Form 7
Plugin URI: https://gist.github.com/2ndkauboy/6123099
Description: Deactivate the JS functionality of Contact Form 7
Version: 0.1
Author: Bernhard Kau
Author URI: http://kau-boys.de
*/
@2ndkauboy
2ndkauboy / add-skype-to-allowed-protocols.php
Last active December 20, 2015 12:39
Enables a user to use skype:{Username} as a link target
<?php
/*
Plugin Name: Add Skype To Allowed Protocols
Plugin URI: https://gist.github.com/2ndkauboy/6133018
Description: Enables a user to use skype:{Username} as a link target
Version: 0.1
Author: Bernhard Kau
Author URI: http://kau-boys.de
*/
@2ndkauboy
2ndkauboy / author-bio-target-blank.php
Last active August 18, 2018 15:09
Add target="_blank" to all URLs in the post author bio
<?php
/*
Plugin Name: Author Bio Target Blank
Plugin URI: https://gist.github.com/2ndkauboy/7136933
Description: Add target="_blank" to all URLs in the post author bio
Version: 0.1
Author: Bernhard Kau
Author URI: http://kau-boys.de
*/
@2ndkauboy
2ndkauboy / pagespeed-css-combination-fix.php
Last active December 26, 2015 12:49
Removes the id attribute from style tags, enabling mod_pagespeed to combine those files
<?php
/*
Plugin Name: Pagespeed CSS Combination Fix
Plugin URI: https://gist.github.com/2ndkauboy/7154341
Description: Removes the id attribute from style tags, enabling mod_pagespeed to combine those files
Version: 0.1
Author: Bernhard Kau
Author URI: http://kau-boys.de
*/