Skip to content

Instantly share code, notes, and snippets.

View glueckpress's full-sized avatar

Caspar Hübinger glueckpress

View GitHub Profile
@Chrico
Chrico / chrico_get_popular_tags_by_category.php
Last active August 29, 2015 14:03
WordPress Dropin: Getting popular Tags by Category
@pippinsplugins
pippinsplugins / gist:146c6f90bc8194c7dba1
Last active May 9, 2017 23:13
This is a simple example that shows how we can maintain backwards compatibility in a plugin for data that used to be stored in post meta but is now stored in a taxonomy term. When this change was made, a new `edd_get_commission_status()` function was introduced, but before this function existed, the status was retrieved by calling `get_post_meta…
<?php
/**
* Filters get_post_meta() to ensure old commission status checks don't fail
*
* The status for commission records used to be stored in postmeta, now it's stored in a taxonomy
*
* @access private
* @since 2.8
* @return mixed
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@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
@maxfenton
maxfenton / a-new-mac-setup.md
Last active April 17, 2024 10:55
System setup stuff for a new OLD mac (a/o 2020)

New computer setup

a/o 2020-05-29

--

Format the drive

  1. Restart with Cmd-R or Cmd-D
  2. Erase drive / 3x if second-hand
  3. Reinstall MacOS
@justintadlock
justintadlock / register-post-type.php
Last active October 22, 2023 05:55
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@eduardozulian
eduardozulian / wp-get-image-sizes.php
Created September 6, 2013 18:23
Get all the registered image sizes along with their dimensions
<?php
/**
* Get all the registered image sizes along with their dimensions
*
* @global array $_wp_additional_image_sizes
*
* @link http://core.trac.wordpress.org/ticket/18947 Reference ticket
* @return array $image_sizes The image sizes
*/
function _get_all_image_sizes() {

Installation

To install, you need to have the WordPress i18n library on your computer. Check it out using SVN:

sudo svn co http://i18n.svn.wordpress.org/tools/trunk/ /usr/lib/wpi18n

You don't have to put the library in /usr/lib/wpi18n, but if you don't put it there, make sure to set the $WP_I18N_LIB environment variable in your .bashrc or .bash_profile file (with no trailing slash):

export WP_I18N_LIB="/path/to/i18n/lib"

@franz-josef-kaiser
franz-josef-kaiser / client_admin_notices.php
Last active August 30, 2019 13:04
Gibt für Kunden Notizen über Änderungen zu WordPress im Adminbereich aus.
<?php
/**
* Plugin Name: Info zu WP-Änderungen
* Description: Informiert Kunden über Änderungen im WordPress Core, der Sprachdatei, etc.
* Version: 15122012.1423
* Author: Franz Josef Kaiser <wecodemore@gmail.com>
* Author URI: https://plus.google.com/107110219316412982437/posts
* License: The MIT License (MIT)
* LicenseURI: http://www.opensource.org/licenses/mit-license.php
*/
@aarongustafson
aarongustafson / watchResize.js
Last active September 16, 2019 14:37
Efficient callback management for window.onresize
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize