Skip to content

Instantly share code, notes, and snippets.

View AllanPooley's full-sized avatar
💃

Allan Pooley AllanPooley

💃
View GitHub Profile
@AllanPooley
AllanPooley / eventbrite.js
Last active July 1, 2021 02:36
Eventbrite Embedded Checkout Snippet
import $ from 'jquery'
const initEventbrite = () => new Promise((resolve) => {
const ready = () => {
resolve(window.EBWidgets)
}
let first = true
const init = () => {
if (window.EBWidgets && window.EBWidgets.createWidget) {
ready()
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 / 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" },
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AllanPooley
AllanPooley / skills.js
Created November 9, 2018 02:41
Compiled List of Skills Array
export const skills = [
'Algorithms',
'Analytical Skills',
'Big Data',
'Calculating',
'Compiling Statistics',
'Data Analytics',
'Data Mining',
'Database Design',
'Database Management',
@AllanPooley
AllanPooley / hobbies.js
Created November 9, 2018 02:13
Compiled List of Hobbies Array
const interests = [
'3D printing',
'Amateur radio',
'Scrapbook',
'Amateur radio',
'Acting',
'Baton twirling',
'Board games',
'Book restoration',
'Cabaret',
@AllanPooley
AllanPooley / moment-greetings.js
Created October 9, 2018 09:59
Time based user greetings (Good Morning, Afternoon, Evening) using moment.js
getGreetingTime = (currentTime) => {
if (!currentTime || !currentTime.isValid()) { return 'Hello'; }
const splitAfternoon = 12; // 24hr time to split the afternoon
const splitEvening = 17; // 24hr time to split the evening
const currentHour = parseFloat(currentTime.format('HH'));
if (currentHour >= splitAfternoon && currentHour <= splitEvening) {
// Between 12 PM and 5PM
return 'Good afternoon';
@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() {
@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');