Skip to content

Instantly share code, notes, and snippets.

View mroffice's full-sized avatar

Euan Callus mroffice

  • Phonesmart Ltd
  • Glasgow
View GitHub Profile
@mroffice
mroffice / Reg Exp.md
Last active February 15, 2016 13:23
An overview of Regular Expressions, with examples

Flags

Flag Description Truthy Example Falsey Example
^ Matches the beginning of input /^b/.test("bananas") /^ananas/.test("bananas")
\ In effect reverses the 'specialness' of a letter /\bb/.test("bananas") /b\b/.test("bananas")
$ Matches the end of input /anas$/.test("bananas") /banan$/.test("bananas")
* Matches the preceeding expression 0 or more times /bananas*/.test("banana") or /bananas*/.test("bananasssssssss") /(bananas)*/.test("monkey")
+ Matches the preceeding expression 1 or more times /bananas+/.test("bananasss") /bananas+/.test("banana")
? Matches the preceeding character 0 or 1 time /ba?na?na?/.exec("banana") // => ["banana"] or /ba?na?na?/.exec("bnn") // => ["bnn"] /ba?na?na?/.exec("bana") // => null
@mroffice
mroffice / Git Cheatsheet.md
Last active December 19, 2017 16:17
An overview of Git, with commands and workflows

Git

Setup

List your current config:

git config --list

Set a config option:

@mroffice
mroffice / PHP.md
Last active February 15, 2016 13:27
An overview of PHP, handy functions and debugging tips.

PHP

Debugging

When you want to learn a new framework or programming language, chances are you'll Google something like "how do i run php locally?" or "how do i make a blog with CakePHP?". Funnily enough, Google will provide you with results that tell you just that, but no more.

If you want to really learn and understand web development or the like, you need to actually know what's happening, rather than just knowing which buttons to hit to make magic happen.

@mroffice
mroffice / MAMP Pro 3 Setup with Clean URLs.md
Last active October 21, 2015 15:36
A quick guide to setting up MAMP Pro 3.0 on your local machine (Mac), with clean URLs (without port number) for your local development environment

MAMP Pro 3.0 with Clean URLs for Mac Guide

  1. Download and install MAMP Pro 3

n.b. You need to download and install both MAMP and MAMP Pro

  1. Under General in the preferences click Set default MAMP ports and hit Save

  2. Open Terminal and stop Apache:

@mroffice
mroffice / SUPEE 6788 patch for Magento Community Edition.md
Last active July 1, 2020 08:18
How I patched our Magento 1.9.2.1 CE with the notorious SUPEE 6788 patch that breaks all your extensions.

See Updates for new additional info

What is SUPEE-6788?

SUPEE-6788 is a bundle of patches for Magento. From the Magento Commerce website:

[SUPEE-6788] provides protection against several types of security-related issues, including remote code execution, information leaks and cross-site scripting.

## Why is it more complicated than previous patches?

@mroffice
mroffice / Fresh Magento Install.md
Last active April 23, 2020 06:53
How to install Magento for your local development environment

How to Create a Fresh Magento Install on your Local Development Environment (Mac)

  1. Download, install and setup MAMP or MAMP Pro

n.b. For further instructions on how to set-up Mamp Pro like a pro, see this Gist

  1. Download the latest version of Magento, and the sample data

  2. Expand the Magento tar file into your chosen directory (I use ~/Dev), rename the created magento folder as you wish and enter the directory

Modes

i // => Changes between input mode and normal mode

v // => Changes between visual mode and normal mode

Movement within File

gg // => Takes you to the begginning of the file

@mroffice
mroffice / Terminal Tips and Tricks.md
Last active February 15, 2016 13:25
Terminal, bash etc.

Terminal Command Cheatsheet

Shortcuts

ctrl + A => Beginning of line
ctrl + E => End of line
ctrl + L => Clears screen
ctrl + U => Clears before cursor
ctrl + H => Backspace
@mroffice
mroffice / Ubuntu Server.md
Last active February 15, 2016 13:25
Basics for server setup in Ubuntu 14.04

## User Setup

### Adding a User

Once you've found a suitable server you'll need to login to it and manage it from the command line. Usually you will be given root access (this means a root user exists on the server, with no restrictions) initially and it's up to you to secure the server with best practices. For any public facing server it is recommended that you setup a new user and disable log in using the root user.

$ adduser <example>

Common Apache Commands and Features

Commands

Checks Syntax of Configuration Files

apachectl -t

Lists Loaded modules