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
/**
* drawer.js
*/
define(['jquery', 'm2base'], function($, m2base) {
'use strict';
var Drawer = window.M2base.Drawer = {
elements: {
@matt-bailey
matt-bailey / aliases.js
Last active May 25, 2017 16:55
Example aliases file for load-grunt-config in our Magento 2 setup
/* global module */
/* File location: dev/tools/grunt/configs/aliases.js */
/* Usage: https://github.com/firstandthird/load-grunt-config#aliases */
'use strict';
module.exports = {
default: [],
@matt-bailey
matt-bailey / meganav-markup.md
Created June 8, 2017 12:01
Instructions on the markup to use in our Magento 2 Meganav module

Meganav Markup

Our Meganav module requires some simple markup in order for it to function correctly.

Here is a basic example showing a single column of links:

<div>

    <!-- Heading with link and toggle -->
@matt-bailey
matt-bailey / prototype.js
Created July 7, 2017 22:33
Prototype 1.7 + fix for conflict with Angular
/**
* Prototype Angular conflict fix
* http://tooschee.com/magento-prototype-vs-angular-conflict-problem/
*/
var bindTemp = Function.prototype.bind;
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
@matt-bailey
matt-bailey / prototype.min.js
Created July 7, 2017 22:34
Prototype 1.7 + fix for conflict with Angular (minified)
function $A(iterable){if(!iterable)return[];if("toArray"in Object(iterable))return iterable.toArray();for(var length=iterable.length||0,results=new Array(length);length--;)results[length]=iterable[length];return results}function $w(string){return Object.isString(string)?(string=string.strip(),string?string.split(/\s+/):[]):[]}function $H(object){return new Hash(object)}function $R(start,end,exclusive){return new ObjectRange(start,end,exclusive)}function $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)elements.push($(arguments[i]));return elements}return Object.isString(element)&&(element=document.getElementById(element)),Element.extend(element)}var bindTemp=Function.prototype.bind;Function.prototype.bind=function(oThis){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var aArgs=Array.prototype.slice.call(arguments,1),fToBind=this,fNOP=function(){},fBound=function(){return fToBind.apply(this ins
@matt-bailey
matt-bailey / magento-notifications.html
Last active September 14, 2017 07:43
Magento notification markup
<ul class="messages">
<li class="error-msg">
<ul>
<li><span>Error Message</span></li>
</ul>
</li>
<li class="success-msg">
<ul>
<li><span>Success Message</span></li>
</ul>
@matt-bailey
matt-bailey / Gruntfile.js
Last active November 13, 2017 18:56
This is the example Gruntfile that goes with my tutorial on front-end flat builds and automation: http://www.gpmd.co.uk/blog/front-end-process-flat-builds-and-automation-part-3-grunt-tasks/
// Generated on 2013-06-04 using generator-webapp 0.1.7
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
@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 / package.json
Created May 8, 2015 12:32
Bare bones package.json file
{
"name": "[project-name]",
"description": "[project-description]",
"version": "1.0.0"
}
@matt-bailey
matt-bailey / prep-ncv-env.sh
Created April 23, 2018 13:20 — forked from kevyworks/prep-ncv-env.sh
Prepare Dev Machine for: Node Composer & Laravel Valet
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# update brew
brew update
# should be added by homebrew installation?
sudo chown -R `whoami`:admin /usr/local/opt
# Node Version Manager