Skip to content

Instantly share code, notes, and snippets.

View Jamiewarb's full-sized avatar
🦑

Jamie Warburton Jamiewarb

🦑
View GitHub Profile
@Jamiewarb
Jamiewarb / slugify.js
Last active March 28, 2019 16:33 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Jamiewarb
Jamiewarb / BaseGrid.vue
Created April 1, 2019 09:17
CSS Grid Vue Component
<template>
<div class="o-grid" :style="gridTemplate">
<slot></slot>
</div>
</template>
<script>
export default {
props: {
rows: {
@Jamiewarb
Jamiewarb / style.css
Created April 6, 2019 11:55
Animated Repeating Gradient
/**
* CSS Animated Repeating Gradient
*/
body {
background: repeating-linear-gradient(-45deg,black,black 20px,white 20px,white 40px);
background-size: 56px 56px; /* This is unique for this background, need to find a pattern and develop a formula */
-webkit-animation: slide 20s infinite linear forwards;
-moz-animation: slide 20s infinite linear forwards;
animation: slide 20s infinite linear forwards;
}
@Jamiewarb
Jamiewarb / BasePaymentForm.js
Last active September 11, 2019 16:31
FormTemplate.js
import BaseForm from './FormTemplate';
import { scaMixin } from '~/mixins/payments/scaMixin';
export default {
name: 'BasePaymentForm',
extends: BaseForm,
mixins: [scaMixin],
methods: {
async onSubmit() {
const response = this.submitForm();
@Jamiewarb
Jamiewarb / Stack.vue
Last active October 14, 2019 08:42
Vue Stack Primitive Object
<template>
<div :class="stackClasses" :data-identifier="configIdentifier">
<slot />
</div>
</template>
<script>
/**
* Flow elements require space to physically and conceptually separate them from the elements that come before and
* after them. This flow space should exist solely between children elements in a container, and not between an element
<template>
<button :class="buttonClasses">
<slot />
</button>
</template>
<script>
const availableSizes = [null, 'tiny', 'small', 'large', 'huge'];
const availableThemes = ['white']; // 'dark', 'primary', 'secondary', 'tertiary'];
/**
/**
* Triggers the sending of notifications for the processed form.
* Please refer to https://gist.github.com/keithdevon/08016bd065397c76045c
* for more information
*/
private function send_notifications( $form_id, $entry_id ) {
$form = \RGFormsModel::get_form_meta( $form_id );
$entry = \RGFormsModel::get_lead( $entry_id );
$notification_ids = [];
foreach( $form['notifications'] as $id => $info ){
@Jamiewarb
Jamiewarb / BaseButton.vue
Last active April 13, 2022 18:49
Vue BaseButton component
<template>
<component
:is="tag"
:class="buttonClasses"
:type="nativeType"
v-bind="$attrs"
@click="$emit('click', $event)"
>
<span class="v-btn__slot"><slot /></span>
</component>
@Jamiewarb
Jamiewarb / AcfImage.js
Last active November 26, 2019 11:23
ACF Image Object Components
import { getPreferredSizeFallbackOrder, getThemeSizes } from '~/utilities/wordpressHelpers';
export default class AcfImage {
constructor(imageObject) {
this.id = (imageObject.id ? imageObject.id : imageObject.ID) || null;
this.title = imageObject.title || null;
this.filename = imageObject.filename || null;
this.filesize = imageObject.filesize || null;
this.url = imageObject.url || null;
this.link = imageObject.link || null;
@Jamiewarb
Jamiewarb / WpLink.js
Last active December 2, 2019 18:00
Vue Link for Wuxt