Skip to content

Instantly share code, notes, and snippets.


Matt Bailey matt-bailey

View GitHub Profile
View sample
<p>Hello World!</p>
matt-bailey / .htaccess
Created Sep 8, 2014
.htaccess file for SilverStripe assets directory
View .htaccess
# Whitelist appropriate assets files.
# Note that you will need to maintain this whitelist yourself if you modify File::$allowed_extensions
# If you are not using Apache then you can ignore this file.
# If you are using IIS then you should look at assets/web.config instead.
# To add an extension to the list, you need to put another string of the form "ext|" on the
# FilesMatch line, inside the parentheses.
matt-bailey / pre-commit
Created Aug 1, 2014
Example front-end workflow pre-commit Git Hook
View pre-commit
#/usr/bin/env bash
# git hook to run a command before `git commit`
# Run the build process `grunt`
echo "--- Verify frontend build passes before we commit..."
echo "--- If the build fails fix the issue and try committing again"
(cd theme; grunt)
matt-bailey /
Last active Sep 28, 2015
Example frontend tools setup shell script (I use it with Vagrant and a Linux box). Includes Java, Node, PhantomJS,, Gunt, Bower and Compass
# Vars
matt-bailey / wp-config.php
Created Jul 2, 2014
Sample Wordpress config file
View wp-config.php
* The base configurations of the WordPress.
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
* This file is used by the wp-config.php creation script during the
matt-bailey / post-merge
Last active Jan 19, 2018
Example front-end workflow post-merge Git Hook
View post-merge
#/usr/bin/env bash
# git hook to run a command after `git merge` or `git pull`
# Check for changed files
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
matt-bailey /
Last active Aug 29, 2015
First run set-up shell script for a front-end workflow
# Assumes the following project structure:
# myproject/site/.git
# myproject/site/.githooks
# myproject/site/.githooks/pre-commit
# myproject/site/.githooks/post-merge
# myproject/site/.shell
# myproject/site/.shell/ (this file)
matt-bailey / async-and-conditional-css-loading.html
Last active Jul 7, 2020
A simple script (based on one by Google) for loading CSS files asynchronously and conditionally based on body tag classes
View async-and-conditional-css-loading.html
<!-- Inlined critical styles -->
<!-- CSS loader -->
/* ==========================================================================
Load CSS asynchronously and conditionally after initial painting
View hello-world.js
(function($) {
$.fn.helloWorld = function() {
this.each( function() {
$(this).text("Hello, World!");
matt-bailey / .gitignore
Last active Jan 2, 2016
Supporting files for a Beginner’s Guide to using Grunt with Magento:
View .gitignore
You can’t perform that action at this time.