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 / form_validation_hightlight.js
Last active November 2, 2015 15:37
User friendly form validation feedback
jQuery( document ).ready( function( $ ) {
$( 'form' ).submit( function() {
$( this ).attr( 'data-touched', true );
} );
$( ':submit' ).click( function() {
$( this ).closest( 'form' ).attr( 'data-touched', true );
} );
<?php
/**
* Plugin Name: Admin Dashboard Columns
* Description: Reactivates the option to set the number of admin dashboard columns
* Version: 1.0.0
* Author: Bernhard Kau
* Author URI: https://kau-boys.de
* License: GPLv3
* License URI: http://www.gnu.org/licenses/gpl-3.0
*/
@2ndkauboy
2ndkauboy / allow-svg-uploads.php
Created December 2, 2015 22:34
Enable the users of your blog to upload SVG files
<?php
/**
* Plugin Name: Allow SVG uploads
* Description: Enable the users of your blog to upload SVG files
* Version: 1.0.0
* Author: Bernhard Kau
* Author URI: https://kau-boys.de
* License: GPLv3
* License URI: http://www.gnu.org/licenses/gpl-3.0
*/
@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 / disable-cachify-on-home-page.php
Created September 4, 2015 15:38
Disable Cachify on home page
<?php
/**
* Plugin Name: Disable Cachify on home page
* Description: This plugin simple disables the caching of the home page with Cachify (see https://wordpress.org/support/topic/exclude-home-page-from-being-cached)
* Author: Bernhard Kau
* Author URI: https://kau-boys.de
*/
add_filter(
'cachify_skip_cache',
@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
*/