Skip to content

Instantly share code, notes, and snippets.

@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@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.
@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);
@mgedmin
mgedmin / StartSSL.md
Last active October 22, 2023 07:52
Free StartSSL.com SSL certificate HOWTO

How to get a free StartSSL.com SSL certificate

I'm writing this up from memory, so errors may appear.

This has been updated to use SHA256 certificates.

Start

  1. Go to http://www.startssl.com/
  2. Click on 'Control Panel'
@chrismccoy
chrismccoy / gitcheats.txt
Last active April 15, 2024 10:58
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# edit all commit messages
git rebase -i --root
# clone all your repos with gh cli tool
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone
@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
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@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:
@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"