Skip to content

Instantly share code, notes, and snippets.

View AllanPooley's full-sized avatar
💃

Allan Pooley AllanPooley

💃
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanPooley
AllanPooley / LookHappyIconBlack.svg
Last active August 8, 2017 22:03
LookHappyIconBlack
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanPooley
AllanPooley / AussiePhoneValidation.js
Created July 25, 2018 00:48
Australian Phone Number Validation in JavaScript
const isPhone = (phoneNumber) => {
const cleanedPhoneNumber = phoneNumber.replace(/-|\s/g, ''); // Remove spaces and hyphens before performing test
const pattern = new RegExp('^(?:\\+?(61))? ?(?:\\((?=.*\\)))?(0?[2-57-8])\\)? ?(\\d\\d(?:[- ](?=\\d{3})|(?!\\d\\d[- ]?\\d[- ]))\\d\\d[- ]?\\d[- ]?\\d{3})$');
return pattern.test(cleanedPhoneNumber);
};
@AllanPooley
AllanPooley / UpdateWPTablesNewAddress.txt
Last active August 7, 2018 00:27
WordPress - Change Address / URL SQL Tables Update
UPDATE wp_options SET option_value = replace(option_value, 'oldURL', 'newURL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldURL','newURL');
UPDATE wp_posts SET post_content = replace(post_content, 'oldURL', 'newURL');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldURL','newURL');
@AllanPooley
AllanPooley / ScrollTrackedComponent.jsx
Created September 9, 2018 21:59
Higher Order Component to track top and bottom position of an element (useful for elements that need to change when inside the viewport)
import React, { Component } from 'react';
import { isClient } from '../../config/app';
const scrollComponent = (WrappedComponent) => {
class ScrollComponent extends Component {
state = {
topPos: 0,
bottomPos: 0
};
componentDidMount() {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanPooley
AllanPooley / flatcolours.js
Last active December 25, 2018 00:48
Flat UI Palette v1 Array of Objects (https://flatuicolors.com/palette/defo)
const flatColours = [
{ label: 'Turquoise', hex: "#1abc9c" },
{ label: 'Emerald', hex: "#2ecc71" },
{ label: 'Peter River', hex: "#3498db" },
{ label: 'Amethyst', hex: "#9b59b6" },
{ label: 'Wet Asphalt', hex: "#34495e" },
{ label: 'Green Sea', hex: "#16a085" },
{ label: 'Nephritis', hex: "#27ae60" },
{ label: 'Belize Hole', hex: "#2980b9" },
{ label: 'Wisteria', hex: "#8e44ad" },