Skip to content

Instantly share code, notes, and snippets.

View xerosai's full-sized avatar
🏠
Working from home

Simon Neufville xerosai

🏠
Working from home
View GitHub Profile
@xerosai
xerosai / FACPaymentUtils.js
Last active October 2, 2020 19:25
Helper class in JavaScript that works with the First Atlantic Commerce payment gateway service. Still a work in progress but, I will turn this into an NPM module eventually
/**
* Filename: FACPaymentUtils.js
* Created by: xerosai @ 22/07/2020 11:10 AM
* @author: Simon Neufville <simon@xrscodeworks.com>
*/
const axios = require('axios');
const CryptoJS = require('crypto-js');
const xmlJS = require('xml-js');
const xml2js = require('xml2js');
@xerosai
xerosai / emailUtilFunctions.js
Created February 4, 2018 02:28
Email Address Validator function that uses Regular Expressions
/**
* Given a string, validates an email address
* @param {String} emailString: the user submitted email address
* @returns {Boolean} true/false: indicates if the email address is valid or not
* */
const isEmailAddressValid = (emailString) => {
const regExpStr = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return regExpStr.test(emailString);
};
@xerosai
xerosai / custom-html-content.liquid
Created January 17, 2018 19:38
Simple HTML Section for Shopify Themes
{% comment %}
Created by: Simon Neufville
Generic HTML section that can be placed anywhere in the customizer.
{% endcomment %}
<div class="shopify-section" data-section-id="{{ section.id }}">
{% if section.settings.heading %}
<h4 class="section-title">{{ section.settings.heading }}</h2>
{% endif %}
<div>
@xerosai
xerosai / textFilters.js
Created December 3, 2017 04:22
Starting point for title case text conversion filter for VueJS
import Vue from 'vue';
const SPACE_CHAR = ' ';
const TEXT_REQUIRED = 'Specify text to be converted to Title Case';
Vue.filter('convertToTitleCase', (value) => {
if (!value) return TEXT_REQUIRED;
return value.toString().split(SPACE_CHAR).map((word) => {
@xerosai
xerosai / vueDateFilters.js
Last active November 16, 2017 16:36
Quick an easy date formatter for VueJS
/*
* Date Format related filters that can be used anywhere (registered globally) in the project
* Import this into your main.js the root of the src directory
* */
import Vue from 'vue';
import moment from 'moment';
Vue.filter('formatToISODate', (value) => {
if (!value) return 'Specify a date to be converted';