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 / 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 / textdomain-de_DE.po
Last active December 12, 2018 19:05
This template can be used to create a po file for a new WordPress translation (in this example for the locale de_DE)
msgid ""
msgstr ""
"Project-Id-Version: <PROJECT NAME>\n"
"POT-Creation-Date: 2015-04-02 16:42+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@glueckpress
glueckpress / jquery.inline.anchor.navigation.js
Last active April 28, 2019 12:23
[JavaScript][jQuery] Inline Anchor Navigation: Adds a smooth scroll effect to URLs containing a hash (#). Excludes single hashes, #respond (WordPress comment forms), and orphaned hash characters at the end of a URL.
/**
* jQuery Inline Anchor Navigation
*
* Adds a smooth scroll effect to URLs containing a hash (#).
* Excludes single hashes, #respond (WordPress comment forms), and orphaned
* hash characters at the end of a URL.
*/
(function($) {
$('a[href*="#"]')
.not('a[href="#"]') // Excemption #1: dummy hrefs
@walterebert
walterebert / elmastudio-unbundle.sh
Last active May 9, 2019 10:38
Unzip & clean Elmastudio WordPress theme bundle
#!/bin/bash
# Unzip theme bundle
unzip elmastudio-themebundle.zip
# Delete MacOS directory
rm -fr __MACOSX
# Unzip theme files
cd elmastudio-themebundle
@derpixler
derpixler / post-count-bubble.php
Last active October 26, 2019 15:59
Add WordPress Nav-Menu Counter
<?php
/*
Plugin Name: Add Postcount to Adminmenu
Plugin URI: https://gist.github.com/derpixler/6d73b30fee3dcaf6d119
Description: This Plugin adds a count bubble on Post menu
Version: 1.0
Author: René Reimann
Author URI: http://www.rene-reimann.de
License:
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@bueltge
bueltge / PortSwitch.php
Last active March 25, 2021 14:52
Port switch to get an workaround to use WordPress Multisite also without the default port 80.
<?php # -*- coding: utf-8 -*-
declare( strict_types = 1 );
/**
* Plugin Name: Port Switch
* Plugin URI: https://gist.github.com/bueltge/51013ab809f5f0f5e305c70c2d393fff
* Description: Port switch to get an workaround to use WordPress Multisite also without the default port 80.
* Version: dev
* Author: Frank Bültge
* Author URI: https://bueltge.de
* License: MIT