Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
2ndkauboy / array_keys_not_empty.php
Created April 7, 2014 16:14
A handy function to check for an array if all key do exist and none of them has an empty value
/**
* Check an array if all key to exists and none of them has an empty value
*
* @param array $array The array.
* @param array $keys The searched keys.
* @return boolean returns true, if all keys existed in the array and none of them had empty values
*/
function array_keys_not_empty($keys, $array){
foreach($keys as $key){
<?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
*/
<?php
/*
Plugin Name: Disable Full Size Image
Description: This plugin removes the "Original Size" option in the drop down when inserting an image into a post
Version: 0.1
Author: Bernhard Kau
Author URI: http://kau-boys.de
*/
function disable_full_size_image( $image_size_names ) {
@2ndkauboy
2ndkauboy / grep_infections.sh
Created May 21, 2014 12:28
This is a simple bash script, that scans text files for typical infections and sends an email to the user. Just setup a cron and run it every couple of hour. And don't worry, even scanning thousand of text files will only take some seconds.
#!/bin/bash
grep '#[0-9a-fA-F]\{6\}#' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' mail@example.com # Send EMail
grep '/\*[0-9a-fA-F]\{6\}\*/' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' mail@example.com # Send EMail
grep 'e=w\["eval"\]' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' mail@example.com # Send EMail
grep '<!--/[0-9a-fA-F]\{6\}-->' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' mail@example.com # Send EMail
grep 'r=eval' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues
@2ndkauboy
2ndkauboy / taxonomy-gallery-shortcode.php
Last active April 15, 2019 15:25
Adding the shortcode "taxonomy_gallery" to list all images for a given taxonomy
@2ndkauboy
2ndkauboy / colors-Twilight_optimized.icls
Created October 9, 2014 21:44
My current PhpStorm color scheme (Twilight with file status colors from the Dracula scheme and Consolas as the main font)
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Twilight_optimized" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="12" />
<option name="CONSOLE_FONT_NAME" value="Lucida Console" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="CARET_COLOR" value="a7a7a7" />
<option name="CARET_ROW_COLOR" value="1b1b1b" />
<option name="CONSOLE_BACKGROUND_KEY" value="141414" />
<?php
/*
* Plugin Name: Text-Widget Highlighted
* Description: Extends the WordPress default text widget by adding a CSS class "widget_text_highlighted" to the container aside HTML tag
* Version: 0.1
* Author: Bernhard Kau
* Author URI: http://kau-boys.de
*/
@2ndkauboy
2ndkauboy / helvetica-neue-desk-interface-reset.css
Created October 28, 2014 23:29
Reset the HTML form buttons font-family from "Helvetica Neue Desk Interface", forced by OS X Yosemite, back to it's original font-family.
input[type="submit"], input[type="reset"], input[type="button"], button {
font-family: inherit;
-webkit-font-smoothing: inherit;
}
@2ndkauboy
2ndkauboy / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@2ndkauboy
2ndkauboy / disable-translation-updates.php
Last active August 18, 2018 15:10
A small WordPress plugin to disable the asynchronous and automatic background translation updates
<?php
/*
Plugin Name: Disable Translation Updates
Plugin URI: https://gist.github.com/2ndkauboy/1907f5847b4e092a88ac
Description: Disable the asynchronous and automatic background translation updates
Version: 1.0.0
Author: Bernhard Kau
Author URI: http://kau-boys.de
License: GPL
*/