Skip to content

Instantly share code, notes, and snippets.

@joemcgill
joemcgill / ricg-merge-notes.md
Created December 10, 2015 16:47
Random notes while thinking about the RICG merge into 4.4

WP RICG Images merge notes

  • Consider merging get_image_tag() and wp_get_attachment_image().
    • Nah, bad idea. While get_image_tag() is only used in the media editor, it probably makes sense to keep the image generation on the back end and front end separated because of how people are likely filtering display.
  • Add an event listener to the editor if we can't do a content filter.
    • Look into adding needed metadata directly to wp.media to avoid the ajax request
  • Add caching to attachment_url_to_postid to speed up multiple requests.
  • Add smart ways to filter sizes globally w/o inducing another wp_get_attachment_image() call.
@joemcgill
joemcgill / wcus2015-notes.md
Created December 10, 2015 16:45
WordCamp US 2015 Notes

Tolman and Jorbin

  • list functions assign variables in reverse order in PHP7
  • HTTP/2
    • makes things faster by managing latency
    • introduces multiplexing in single TCP connections
    • #core-http on slack (working group)
  • CSS4
    • CSS color() function coming soon
    • varables in CSS
@joemcgill
joemcgill / remove_max_srcset_image_width.php
Created December 12, 2015 06:25
remove_max_srcset_image_width
// Remove max_srcset_image_width.
function remove_max_srcset_image_width( $max_width ) {
return false;
}
add_filter( 'max_srcset_image_width', 'remove_max_srcset_image_width' );
@joemcgill
joemcgill / WP custom post time
Created May 25, 2013 16:52
A custom post time function for WordPress that allows you to change the output for posts that are published today.
/**
* custom post time function
*
* @uses global $post, get_the_time() and get_the_date()
* @vars $d (for custom date formatting), $t (for custom time formatting)
* @returns $my_post_time
*/
function my_post_time($d, $t) {
global $post;

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@joemcgill
joemcgill / location.attr reference
Created October 14, 2013 22:21
Nice reference of browswer location attributes cribbed from this Stack Overflow thread: http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-javascript
http://www.refulz.com:8082/index.php#tab2?foo=123
Property Result
-------------------------------------------
host www.refulz.com:8082
hostname www.refulz.com
port 8082
protocol http
pathname index.php
@joemcgill
joemcgill / README.md
Created November 22, 2013 07:16 — forked from oodavid/README.md
Steps for deploying a site with Git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@joemcgill
joemcgill / form_validation_browser_plug
Created November 27, 2013 18:04
When using HTML5 forms elements and validation, interrupt a browser's default invalidation message and plug in your own validation code (e.g., append an invalid class to the input and style accordingly).
document.addEventListener('invalid', (function(){
return function(e){
//prevent the browser from showing default error bubble/ hint
e.preventDefault();
// optionally fire off some custom validation handler
myvalidationfunction(e);
};
})(), true);
@joemcgill
joemcgill / .bash_prompt
Created December 13, 2013 19:21
Custom bash prompt, inspired by Paul Irish's dotfiles repo.
#!/bin/bash
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
default_username='joemcgill'
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
@joemcgill
joemcgill / wp_pinterest_hovers.js
Created January 2, 2014 19:54
Automatically add Pinterest pin overlays to Wordpress blog images. This should eventually be turned into a plugin probably.
/**
* Pinterest Overlay Code
* @require jQuery 1.8
*/
var bs_pinButtonURL = "//link.to/image.png";
var bs_pinButtonHeight = 72;
var bs_pinButtonWidth = 72;
var bs_yourUrl = $(location).attr('host');
var bs_pinButtonPos = "bottomright";