Skip to content

Instantly share code, notes, and snippets.

View JasonMortonNZ's full-sized avatar

Jason Morton JasonMortonNZ

View GitHub Profile
@JasonMortonNZ
JasonMortonNZ / Customer.php
Created November 30, 2015 19:34
Magento 2 module to extend Customer (not working)
<?php
namespace Jason\OCUser\Model;
use Magento\Customer\Model\Customer as MCustomer;
class Customer extends MCustomer
{
/**
* Load customer by email
*
@JasonMortonNZ
JasonMortonNZ / vhost.sh
Last active January 1, 2016 10:09
Create a apache-2.4 vhost
#! /bin/bash
# May need to run this as sudo!
# I have it in /usr/local/bin and run command 'vhost' from anywhere, using sudo.
#
# Show Usage, Output to STDERR
#
function show_usage {
cat <<- _EOF_
@JasonMortonNZ
JasonMortonNZ / createdb.sh
Last active January 1, 2016 10:09
Create a new MySQL table and user.
#!/bin/bash
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
USERNAME="root"
PASSWORD="password"
Q1="CREATE DATABASE IF NOT EXISTS $1;"
Q2="GRANT USAGE ON *.* TO $2@localhost IDENTIFIED BY '$3';"
@JasonMortonNZ
JasonMortonNZ / gist:5499511
Created May 2, 2013 01:02
Laravel S3 image uploader
// Routes.php
Route::get('upload', function()
{
return View::make('upload-form');
});
Route::post('upload', function()
{
// Get and move uploaded file.
@JasonMortonNZ
JasonMortonNZ / jQuery with fallback
Last active December 16, 2015 04:59 — forked from ZweiSteinSoft/jquery-fallback.html
jQuery with Google CDN Fallback
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="//yoursite.com/libs/jquery.js"><\/script>')</script>