Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Bailey matt-bailey

View GitHub Profile
View sample
<p>Hello World!</p>
@matt-bailey
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
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
matt-bailey / frontend-tools.sh
Last active Sep 28, 2015
Example frontend tools setup shell script (I use it with Vagrant and a Linux box). Includes Java, Node, PhantomJS, sitespeed.io, Gunt, Bower and Compass
View frontend-tools.sh
#!/bin/bash
# Vars
java="java"
xsltproc="xsltproc"
node="node"
phantomjs="phantomjs"
grunt="grunt"
bower="bower"
compass="compass"
@matt-bailey
matt-bailey / wp-config.php
Created Jul 2, 2014
Sample Wordpress config file
View wp-config.php
<?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 http://codex.wordpress.org/Editing_wp-config.php 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
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
matt-bailey / frontend-setup.sh
Last active Aug 29, 2015
First run set-up shell script for a front-end workflow
View frontend-setup.sh
#!/bin/bash
# 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/frontend-setup.sh (this file)
@matt-bailey
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
<html>
<head>
<!-- Inlined critical styles -->
<style>.blue{color:blue;}</style>
<!-- CSS loader -->
<script>
/* ==========================================================================
Load CSS asynchronously and conditionally after initial painting
View hello-world.js
(function($) {
$.fn.helloWorld = function() {
this.each( function() {
$(this).text("Hello, World!");
});
}
}(jQuery));
@matt-bailey
matt-bailey / .gitignore
Last active Jan 2, 2016
Supporting files for a Beginner’s Guide to using Grunt with Magento: http://www.gpmd.co.uk/blog/a-beginner-s-guide-to-using-grunt-with-magento/
View .gitignore
.idea/
.project
*.sublime-project
*.sublime-workspace
*.tmproj
*.bak
*.swp
*~.nib
.sass-cache/
node_modules/
You can’t perform that action at this time.