Skip to content

Instantly share code, notes, and snippets.

@mattbanks
mattbanks / functions.php
Created February 11, 2013 16:04
Run custom loop for taxonomy archive for proper formatting, use pre_get_posts to change query to show all posts-per-page
/**
* Show header on archive pages
*/
function mb_archive_header() {
global $post;
echo '<h1 class="archive-title">Archive for &#8216;' . single_cat_title('', false) . '&#8217;</h1>';
}
/**
@mattbanks
mattbanks / Package Control.sublime-settings
Created February 13, 2013 19:13
package control user prefs file
{
"auto_upgrade_last_run": null,
"installed_packages":
[
"AdvancedNewFile",
"AndyJS2",
"ApacheConf.tmLanguage",
"Backbone.js",
"CoffeeScript",
"DocBlockr",
@mattbanks
mattbanks / Gruntfile.js
Last active June 13, 2019 12:09
Gruntfile.js for use in developing and deploying WordPress themes
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
// watch for changes and trigger compass, jshint, uglify and livereload
watch: {
@mattbanks
mattbanks / package.json
Last active December 14, 2015 20:19
package.json for use with Grunt in developing and deploying WordPress themes
{
"name": "wordpress-starter-theme",
"version": "1.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-compass": "~0.2.0",
"grunt-contrib-imagemin": "~0.1.4",
"grunt-contrib-jshint": "~0.4.3",
"grunt-contrib-uglify": "~0.2.0",
@mattbanks
mattbanks / installing.php
Created March 21, 2013 14:24
Run wp_install() as an output script in an Alfred 2 Workflow
<?php
$site = $_GET['q'];
$dir = "/Users/MYUSERNAME/Sites/$site";
$siteUrl = "http://sites.dev/$site";
$username = 'MYUSERNAME';
$email = 'MYEMAIL';
$password = 'MYPASSWORD';
@mattbanks
mattbanks / Gruntfile-js-issue.js
Created April 9, 2013 13:44
Gruntfile.js where JS is not soft refreshing with LiveReload - getting a hard refresh for JS changes in the compiled *.min.js files after run through uglify
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
// watch for changes and trigger compass, jshint, uglify and livereload
watch: {
compass: {
#!/usr/bin/env ruby
# 1. export your RIL bookmarks
# 2. save this file to the same directory where your ril_export.html is
# 3. change username and password in the script bellow
# 4. run 'ruby ril_to_instapaper.rb' in terminal
require "cgi"
require "net/http"
require "net/https"
@mattbanks
mattbanks / php-expires-headers.php
Created August 15, 2013 13:29
PHP no caching expires headers
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
@mattbanks
mattbanks / mb_html5_doctype.php
Last active December 21, 2015 07:18
Adding Conditional Classes to the HTML Tag in Genesis 2.0
/**
* HTML5 DOCTYPE
* removes the default Genesis doctype, adds new html5 doctype with IE8 detection
*/
function mb_html5_doctype() {
?>
<!DOCTYPE html>
<!--[if IE 8]> <html class="lt-ie9" <?php language_attributes( 'html' ); ?>> <![endif]-->
<!--[if gt IE 8]><!--> <html <?php language_attributes( 'html' ); ?>> <!--<![endif]-->