Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
2ndkauboy / _respond-to-ie.scss
Last active Oct 13, 2015
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.
View _respond-to-ie.scss
@mixin respond-to-ie($size){
@if $old-ie {
@content;
} @else {
@media all and (min-width: $size) {
@content;
}
}
}
@2ndkauboy
2ndkauboy / _animation.scss
Last active Dec 12, 2015
A simple mixins to use CSS3 anmiations in SASS with all vendor prefixes and the possibility to set any specific animation property.
View _animation.scss
@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 Dec 16, 2015
A simple mixin to wrap some CSS into a pixel-ration media query
View _pixelratio.scss
@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 Dec 16, 2015
A simple mixin to use a different background images for HiDPI devices.
View _background_image_hidpi.scss
@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
View array_match_string.php
<?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 Dec 20, 2015
Deactivate the JS functionality of Contact Form 7
View ajax-deactivation-contact-form-7.php
<?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 Dec 20, 2015
Enables a user to use skype:{Username} as a link target
View add-skype-to-allowed-protocols.php
<?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 Aug 18, 2018
Add target="_blank" to all URLs in the post author bio
View author-bio-target-blank.php
<?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 Dec 26, 2015
Removes the id attribute from style tags, enabling mod_pagespeed to combine those files
View pagespeed-css-combination-fix.php
<?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
*/
View gallery-shortcode-change-default-size.php