Skip to content

Instantly share code, notes, and snippets.

@kevinwhoffman
kevinwhoffman / resources-web-developers-designers.md
Last active Nov 23, 2022
Resources for Web Developers and Designers
View resources-web-developers-designers.md

Resources for Web Developers and Designers

This is an incomplete list of resources including courses and individuals who publish content that has helped me grow as a web developer and designer. Many of these resources are WordPress-specific as that is my current area of specialization. This list will grow over time. If you've got something to add, send me a link @kevinwhoffman and I'll check it out!

Course Providers

View Crafted Gruntfile.txt
/*global module:false*/
/*global require:false*/
/*jshint -W097*/
"use strict";
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
@dtbaker
dtbaker / query.php
Last active Aug 29, 2015
Hacky caching with PHP
View query.php
$key = $_SERVER['REMOTE_ADDR'] . serialize($_REQUEST);
if(strlen($key) < 500){ // help prevent flooding.
$key = md5($key);
// global so we can find it in the shutdown function
$GLOBALS['wordpress_temp_file'] = dirname(__FILE__).'/cache/wp_'.basename($key);
if(is_file($GLOBALS['wordpress_temp_file']) && filemtime($GLOBALS['wordpress_temp_file']) > (time() - 3600)){
$data = unserialize(file_get_contents($GLOBALS['wordpress_temp_file']));
echo $data['content'];
exit;
}
@chriscoyier
chriscoyier / frontendplugins.md
Last active Mar 3, 2021
How WordPress Plugins Should Handle Front End Resources
View frontendplugins.md

How WordPress Plugins Should Handle Front End Resources

This is a WORK IN PROGRESS intended for fleshing out and feedback

It's very common for people to be unhappy with how a WordPress plugin adds front end resources to their site. If a plugin needs CSS, the plugin will add a <link> element to that CSS. If the plugin needs JavaScript, it will add a <script> to that JavaScript.

Plugins do this because it works. It's damn important for a WordPress plugin to work, even in adverse conditions. They rightfully want good ratings and little customer support.

But this comes at the cost of additional HTTP requests. In optimizing front end performance of a site, reducing the number of HTTP requests is a huge thing. Front end developers want to decide and control how front end resources are being handled, and WordPress plugins don't typically make this easy on them.

@davatron5000
davatron5000 / Sublime Text Setup.md
Last active Jun 15, 2022
A new user's guide to SublimeText 2. Estimated reading time: 2 mins. Estimated workthrough time: 12 minutes.
View Sublime Text Setup.md

Make it useful

  • Install Package Control. For SublimeText 2, paste the following in Terminal:
import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can 'livesearch through. After installing plugins, they should be running.

@sevenspark
sevenspark / functions.php
Created Aug 8, 2013
UberMenu Post Grid Shortcode & Styling
View functions.php
<?php
/** ADD EVERYTHING BELOW THIS LINE TO YOUR CHILD THEME'S FUNCTIONS.PHP **/
function ubermenu_post_grid( $atts ){
//we're going to need access to the UberMenu object for image functionality
global $uberMenu;
@Japh
Japh / qa_wptsr.md
Last active May 14, 2017
Q & A on WordPress Theme Submission Requirements
View qa_wptsr.md
@bitfade
bitfade / gist:4555047
Last active Jan 21, 2022
WordPress - Remove empty p tags for custom shortcodes
View gist:4555047
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
View wp-query-ref.php
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@mattwiebe
mattwiebe / wp_plugin_stub.php
Created Jan 10, 2012
A good starting place for a static class-based WordPress plugin
View wp_plugin_stub.php
<?php
/*
Plugin Name: A Plugin Name
Plugin URI: http://somadesign.ca/
Description: Be descriptive.
Version: 0.1
Author: Soma Design
Author URI: http://somadesign.ca/
License: GPL v2