Skip to content

Instantly share code, notes, and snippets.

Matt Bailey matt-bailey

View GitHub Profile
View hello-world.js
(function($) {
$.fn.helloWorld = function() {
this.each( function() {
$(this).text("Hello, World!");
});
}
}(jQuery));
@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 / 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 / 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 / .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.
#
View sample
<p>Hello World!</p>
@matt-bailey
matt-bailey / nosto-actions.phtml
Created Feb 4, 2015
Magento & Nosto: How to add 'Add To Cart' and 'Add To Wishlist' buttons to Nosto recommendation templates
View nosto-actions.phtml
<div class="actions">
<button class="button btn-cart" type="button" title="Add to Basket" onclick="nostojs(function(api){api.reportAddToCart('$!product.productId','$!divId');});setLocation('/checkout/cart/add/product/$!product.productId');">
<span><span>Add to Basket</span></span>
</button>
<a class="button link-wishlist" href="/wishlist/index/add/product/$!product.productId">Add to Wishlist</a>
</div>
@matt-bailey
matt-bailey / nosto-stars.html
Last active Aug 29, 2015
Magento & Nosto: How to add Star Ratings to Nosto recommendation templates
View nosto-stars.html
<!--
/**
* Add this markup to the recommendation template in your Nosto control panel
*/
-->
<div class="ratings-wrapper">
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:$!product.tags1.get(0)%"></div>
</div>
@matt-bailey
matt-bailey / local.xml
Created Mar 11, 2015
How to edit Magento's top links
View local.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="root">
<reference name="top.links">
<!-- Add custom links. Pretty self-explanatory.
Dig into app/code/core/Mage/Page/Block/Template/Links.php for more info -->
<action method="addLink" translate="label title">
<label>About Us</label>
<url>about</url> <!-- can use full url also -->
@matt-bailey
matt-bailey / style-guide.html
Last active Aug 29, 2015
Basic HTML markup for use in style guides - it contains some of the standard BEM style class naming conventions I use.
View style-guide.html
<h1>Style Guide</h1>
<hr>
<h2>Display Headings</h2>
<h1 class="font-family--tradegothic">Display Heading 1<br>
<span class="sub-heading">Display Heading 1 Sub-heading</span></h1>
<h2 class="font-family--tradegothic">Display Heading 2<br>
<span class="sub-heading">Display Heading 2 Sub-heading</span></h2>
You can’t perform that action at this time.