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
@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 / 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 / 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 / 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: [],
/**
* drawer.js
*/
define(['jquery', 'm2base'], function($, m2base) {
'use strict';
var Drawer = window.M2base.Drawer = {
elements: {
@matt-bailey
matt-bailey / Gruntfile.js
Created May 8, 2015 12:26
SC5 Style Guide Generator Grunt usage instructions
module.exports = function(grunt) {
var gulp = require('gulp'),
styleguide = require('sc5-styleguide');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
@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/
@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",
$ 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 / gist:5765048
Created June 12, 2013 13:04
Yeoman - Yo webapp generator directory structure
myproject/
|-- .sass-cache/
|-- .tmp/
|-- app/
| |-- components/
| |-- images/
| |-- scripts/
| `-- styles/
|-- dist/
| |-- components/