Skip to content

Instantly share code, notes, and snippets.

@kurtpayne
kurtpayne / cache.htaccess
Created June 13, 2012 00:10
.htaccess caching rules
<IfModule mod_mime.c>
# Text
AddType text/css .css
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType text/plain .txt
AddType text/xml .xml
@kurtpayne
kurtpayne / cache.htaccess
Created June 13, 2012 00:10
.htaccess caching rules
<IfModule mod_mime.c>
# Text
AddType text/css .css
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType text/plain .txt
AddType text/xml .xml
@kurtpayne
kurtpayne / web.config
Created June 13, 2012 00:16
web.config with caching and compression
<?xml version="1.0" encoding="UTF-8"?>
<!-- web.config contributed to html5boilerplate by Velir : velir.com -->
<configuration>
<system.webServer>
<httpCompression directory="%SystemDrive%\websites\_compressed" minFileSizeForComp="1024">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<?php
$wp_constant_mgr = new class WP_Constants_Manager();
function wp_constant( $name, $value ) {
global $wp_constant_mgr;
if ( UNIT_TEST_MODE )
$wp_constant_mgr->set( $name, $value );
else
define( $name, $value );
@kurtpayne
kurtpayne / text_wife.js
Created June 23, 2012 04:58
Text my wife when I leave work (onX)
// Initializing variables
var friend = { name : "WIFE",phoneNumber : "2225551234" } ;
var messageText = "I'm on my way home";
var action = "exit" /* leave */;
var location = { name : "work",latitude : "XX.123456",longitude : "-YY.123456" } ;
var time = "4:45 PM";
// End of variables initializing
console.log('Started script: Text ' + friend.name + ' \"' + messageText + '\" when I ' + action + ' ' + location.name + ' after ' + time );
@kurtpayne
kurtpayne / phpl
Created July 3, 2012 18:11
php lint helper
#!/bin/bash
find $1 \( -type f -and \( -name "*.php" -or -name "*.inc" -or -name "*.phtml" \) \) -exec php -l {} \; | grep -v "No syntax errors"
@kurtpayne
kurtpayne / janky_timer.php
Created July 18, 2012 19:51
Janky timer thingy
<?php
// Requests lib
// See https://github.com/rmccue/Requests
require_once 'Requests/library/Requests.php';
Requests::register_autoloader();
// Stopwatch
$timer = new Timer();
@kurtpayne
kurtpayne / l10n.patch
Created July 19, 2012 20:59
Don't create a new NOOP_Translations object for every domain
Index: wp-includes/l10n.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/l10n.php (revision 21279)
+++ wp-includes/l10n.php (revision )
@@ -493,10 +493,11 @@
* @param string $domain
* @return object A Translation instance
@kurtpayne
kurtpayne / faster_filters_maybe.patch
Created July 19, 2012 21:03
Faster filters, maybe
Index: wp-includes/plugin.php
===================================================================
--- wp-includes/plugin.php (revision 21276)
+++ wp-includes/plugin.php (working copy)
@@ -164,12 +164,26 @@
$args = func_get_args();
do {
- foreach( (array) current($wp_filter[$tag]) as $the_ )
- if ( !is_null($the_['function']) ){
@kurtpayne
kurtpayne / 21481.patch
Created August 5, 2012 23:13
21481.patch
Index: wp-admin/includes/image.php
===================================================================
--- wp-admin/includes/image.php (revision 21427)
+++ wp-admin/includes/image.php (working copy)
@@ -143,9 +143,11 @@
}
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
+
+ $image = wp_load_image( $file );