Skip to content

Instantly share code, notes, and snippets.

@mattbanks
mattbanks / gulpfile.js
Created February 4, 2014 20:18
Setup for using gulp in developing and deploying WordPress themes
// Load plugins
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')({ camelize: true }),
lr = require('tiny-lr'),
server = lr();
// Styles
gulp.task('styles', function() {
return gulp.src('assets/styles/source/*.scss')
.pipe(plugins.rubySass({ style: 'expanded', compass: true }))
@mattbanks
mattbanks / taxonomy-query-loop.php
Created April 2, 2014 16:51
Loop through each taxonomy term, run a new WP_Query in each term
<?php
// Get terms
// http://codex.wordpress.org/Function_Reference/get_terms
// use $args array in second parameter if needed
$my_categories = get_terms( 'TERM_NAME_HERE' );
$my_categories_count = count( $my_categories );
if ( $my_categories_count > 0 && is_array( $my_categories ) ) {
echo '<div class="wrap">';
@mattbanks
mattbanks / wp-setup.sh
Created March 14, 2014 18:01
Scaffold a new WordPress development site in Alfred, utilizing WP-CLI. Use this script to run as a Terminal Script. Customize for your theme needs, plugin needs, etc.
# Create directory for new site
cd ~/Sites
mkdir {query}
cd {query}
# Download latest version of WordPress
wp core download
# Setup wp-config file with WP_DEBUG enabled
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP
@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 March 12, 2018 17:59
base package.json for jest and eslint
{
"name": "project-name",
"description": "project description",
"author": "Matt Banks <email@here.com>",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "project-url-here"
},
"scripts": {
@mattbanks
mattbanks / .editorconfig
Created March 12, 2018 17:48
base editorconfig
# EditorConfig coding styles definitions. For more information about the
# properties used in this file, please see the EditorConfig documentation:
# http://editorconfig.org/
# indicate this is the root of the project
root = true
[*]
charset = utf-8
end_of_line = lf
module.exports = {
// collectCoverage: true,
// collectCoverageFrom: [
// 'app/**/*.js'
// ],
testResultsProcessor: 'jest-junit',
};
@mattbanks
mattbanks / .eslintrc
Created March 12, 2018 17:47
base eslintrc
{
"extends": [
"airbnb-base",
"prettier"
],
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"classes": true
}
@mattbanks
mattbanks / Contract Killer 3.md
Created March 7, 2016 01:50 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@mattbanks
mattbanks / .hyper.js
Created May 10, 2017 13:34
Hyper config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks