Skip to content

Instantly share code, notes, and snippets.

Avatar

Carl Alexander carlalexander

View GitHub Profile
@carlalexander
carlalexander / expect-header-fix.php
Last active Apr 28, 2021
WordPress "Expect" header fix
View expect-header-fix.php
<?php
/**
* By default, cURL sends the "Expect" header all the time which severely impacts
* performance. Instead, we'll send it if the body is larger than 1 mb like
* Guzzle does.
*/
function add_expect_header(array $arguments)
{
$arguments['headers']['expect'] = !empty($arguments['body']) && strlen($arguments['body']) > 1048576 ? '100-Continue' : '';
View keybase.md

Keybase proof

I hereby claim:

  • I am carlalexander on github.
  • I am carlalexander (https://keybase.io/carlalexander) on keybase.
  • I have a public key ASAeNjSudK8Ar5DH54HtLiabfIcP4VDFerAVPQwo_HSvbwo

To claim this, I am signing this object:

@carlalexander
carlalexander / AdminPage.php
Last active May 14, 2021
WordPress and the single responsibility principle
View AdminPage.php
<?php
namespace WPMemeShortcode;
/**
* The WordPress Meme Shortcode admin page.
*
* @author Carl Alexander
*/
class AdminPage
@carlalexander
carlalexander / bootstrap-formlabel.js
Created Nov 9, 2011
Form label plugin for bootstrap
View bootstrap-formlabel.js
!function( $ ){
/* FORM LABEL PLUGIN DEFINITION
* ============================ */
$.fn.formLabel = function ( options ) {
var options = $.extend({}, $.fn.formLabel.defaults, options);
return this.each(function () {
var $holding = $(this),
$input = $holding.find(':input'),