Skip to content

Instantly share code, notes, and snippets.

View matt-bailey's full-sized avatar

Matt Bailey matt-bailey

  • GPMD
  • London, UK
View GitHub Profile
$ npm install grunt
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/dateformat/1.0.2-1.2.3
npm http GET https://registry.npmjs.org/eventemitter2
npm http GET https://registry.npmjs.org/findup-sync
npm http GET https://registry.npmjs.org/glob
@matt-bailey
matt-bailey / Test.js
Last active January 2, 2016 14:49
Test stuff...
console.log("Some inline code");
{
"name": "my-theme",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-compass": "~0.7.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-imagemin": "~0.4.0",
@matt-bailey
matt-bailey / .gitignore
Last active January 2, 2016 14:59
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/
.idea/
.project
*.sublime-project
*.sublime-workspace
*.tmproj
*.bak
*.swp
*~.nib
.sass-cache/
node_modules/
(function($) {
$.fn.helloWorld = function() {
this.each( function() {
$(this).text("Hello, World!");
});
}
}(jQuery));
@matt-bailey
matt-bailey / async-and-conditional-css-loading.html
Last active March 17, 2021 22:09
A simple script (based on one by Google) for loading CSS files asynchronously and conditionally based on body tag classes
<html>
<head>
<!-- Inlined critical styles -->
<style>.blue{color:blue;}</style>
<!-- CSS loader -->
<script>
/* ==========================================================================
Load CSS asynchronously and conditionally after initial painting
@matt-bailey
matt-bailey / frontend-setup.sh
Last active August 29, 2015 14:03
First run set-up shell script for a front-end workflow
#!/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 / post-merge
Last active January 19, 2018 01:37
Example front-end workflow post-merge Git Hook
#/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 / wp-config.php
Created July 2, 2014 14:54
Sample Wordpress config file
<?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 / frontend-tools.sh
Last active September 28, 2015 22:01
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
#!/bin/bash
# Vars
java="java"
xsltproc="xsltproc"
node="node"
phantomjs="phantomjs"
grunt="grunt"
bower="bower"
compass="compass"
@matt-bailey
matt-bailey / pre-commit
Created August 1, 2014 08:32
Example front-end workflow pre-commit Git Hook
#/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)