Skip to content

Instantly share code, notes, and snippets.

@necolas
necolas / .htaccess
Created April 9, 2012 22:19
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
@glueckpress
glueckpress / wp-bootstrap-subheading.php
Last active April 28, 2019 11:22
[WordPress] Add Bootstrap sub-heading to post title. Simply write something like "My post title | Smaller sub-line added here." into your post title or widget title field.
<?php
/**
* Append a sub-heading to WordPress post titles
*
* Input: My title | my sub-title
* Output: My title <small>my sub-title</small>
*
* The filter the_title() is used for posts/pages AND nav menus in WordPress.
* In order to filter only post/page titles, not nav menu items, we need to
(function(){
var q = [],
load = function (v_opt){
var version = v_opt || "1.7.2";
loadScript("http://ajax.googleapis.com/ajax/libs/jquery/" + version + "/jquery.min.js", function(){
doJquery();
});
},
@peterherrmann
peterherrmann / gist:2836208
Created May 30, 2012 13:08
Spreadsheet Splitter - Google Apps Script
// Creates new spreadsheets based on a column containing email addresses
// in the starting spreadsheet.
// Each new spreadsheet will contain the full set of rows for that email address.
// It will then be shared with that email address and a link emailed.
var EMAIL_COLUMN = 2; //Use the number: A=1,B=2,Z=26 etc
var ALSO_SHARE_WITH = ""; // Add any additional addresses here. Separated multiples with commas.
var NUM_HEADER_ROWS = 1; // The number of header rows.
// Do not change anything below this line
// 24 Nov 2010 - test mode works correctly after Google changes (session broke after Browser.msgBox)
anonymous
anonymous / gist:2912227
Created June 11, 2012 19:44
php slugify string
<?php
function slugify($str) {
$search = array('Ș', 'Ț', 'ş', 'ţ', 'Ş', 'Ţ', 'ș', 'ț', 'î', 'â', 'ă', 'Î', 'Â', 'Ă', 'ë', 'Ë');
$replace = array('s', 't', 's', 't', 's', 't', 's', 't', 'i', 'a', 'a', 'i', 'a', 'a', 'e', 'E');
$str = str_ireplace($search, $replace, strtolower(trim($str)));
$str = preg_replace('/[^\w\d\-\ ]/', '', $str);
$str = str_replace(' ', '-', $str);
return preg_replace('/\-{2,}', '-', $str);
}
@robtarr
robtarr / resize.js
Created July 9, 2012 14:51
Google Analytics Resize Tracking
(function() {
var resizeTimer;
// Assuming we have jQuery present
$( window ).on( "resize", function() {
// Use resizeTimer to throttle the resize handler
clearTimeout( resizeTimer );
resizeTimer = setTimeout(function() {
@jimmynotjim
jimmynotjim / more-mute-regex.md
Created July 19, 2012 14:37 — forked from imathis/tweetbot-mute-regex.md
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

##Simply annoying Tweets

Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD

([a-z])/1{4}

Tweet w/ just a single hashtag: #omgthissucks

^ *#[^ ]+$
@aliciaduffy
aliciaduffy / gist:3362670
Last active May 12, 2022 03:49
WordPress / ADMIN / Remove meta boxes from post edit screen
<?php
add_action( 'add_meta_boxes', 'NAME_remove_meta_boxes', 100);
function NAME_remove_meta_boxes() {
remove_meta_box( 'trackbacksdiv', 'post', 'normal' ); // Trackbacks meta box
remove_meta_box( 'postcustom', 'post', 'normal' ); // Custom fields meta box
remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
remove_meta_box( 'slugdiv', 'post', 'normal' ); // Slug meta box
remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
remove_meta_box( 'formatdiv', 'post', 'normal' ); // Post format meta box
@mbijon
mbijon / benchmark_wordpress_seo-auto-linker.php
Created September 18, 2012 08:57
Quick benchmarker for WordPress Plugin: SEO Auto Linker. For @danielbachhuber b/c it uses many preg_matches
<?php
/*
* Usage:
* 1. Paste into Debug Bar console and Run
* 2. Run it several times (just in case iTunes is running on your dev server)
*
* Benchmarking Alternatives:
* - Wrap the real SEO Auto Linker for wp-cli and replace the call to content()
* - Add this quick & dirty benchmark loop to Debug Bar
*
@hidesakai
hidesakai / jquery.gaformanalysis.js
Created October 3, 2012 14:43
フォーム内容をGAトラックイベントへPush
var gaForm = gaForm || {};
jQuery(function($) {
var defaults = {
Forms:"#form",
Category:"analysisForm",
Action:"id",
inputRadio: true,
inputSelect: true,
inputCheckBox: true
};