Skip to content

Instantly share code, notes, and snippets.

View neilbradley's full-sized avatar

Neil Bradley neilbradley

View GitHub Profile
module.exports = {
plugins: [
require('postcss-import')({
plugins: [
require('stylelint')
]
}),
require('tailwindcss')('./tailwind.js'),
require('autoprefixer')(),
],
@neilbradley
neilbradley / pans.sql
Created December 19, 2017 09:53
Search SagePay Suite Transaction Table in Magento for Customers who mistakenly entered a Credit Card PAN into the Nickname field
SELECT * FROM sagepaysuite_transaction WHERE sagepaysuite_transaction.nickname REGEXP '[[:<:]]([[:digit:]][- ]?){13,16}[[:>:]]'
from django import forms
from django.contrib.auth.models import User
from django.forms.util import ErrorList
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.contrib.auth import authenticate, login
from django.utils.safestring import mark_safe
from django.forms.models import modelformset_factory
from captcha.fields import CaptchaField
from django.forms.extras.widgets import SelectDateWidget
from django.utils.translation import ugettext_lazy as _
import sys, os
# add the site specific path, e.g. /uk/
COUNTRY_SITE_BASE = os.path.dirname(__file__)
sys.path.append(COUNTRY_SITE_BASE)
LOG_FILE = os.path.join(COUNTRY_SITE_BASE, "logs/site_log.txt")
COUNTRY = 'au'
@neilbradley
neilbradley / payment.py
Created October 11, 2017 14:25
sharedapps/eway/payment.py
import os, logging
import requests
import json
from django.conf import settings
RESPONSE_CODES = {
'F7000': "Undefined Fraud",
'V5000': "Undefined System",
@neilbradley
neilbradley / ordersbycustomeratt.php
Last active August 14, 2017 13:46
Get all Magento orders between two dates with status new and placed by a customer with a specific customer attribute set
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$fromDateStart = '2017-05-01';
$toDateEnd = '2017-08-10';
$fromDate = date('Y-m-d H:i:s', strtotime($fromDateStart));
$toDate = date('Y-m-d H:i:s', strtotime($toDateEnd));
@neilbradley
neilbradley / lever_api_posting_example.php
Created August 4, 2017 12:58
Lever API Job Posting example
<?php
// http://s20493.p303.sites.pressdns.com/job-details/?id=9f89449a-451c-4e50-8f4a-8b92c6a0a7e1
global $val;
$val = "9f89449a-451c-4e50-8f4a-8b92c6a0a7e1";//posting id
function post_to_url($url, $data)
{
$post = curl_init();
curl_setopt($post, CURLOPT_URL, $url);
curl_setopt($post, CURLOPT_POST, count($data));
@neilbradley
neilbradley / config.php
Last active August 4, 2017 10:45
Sending Transactional Email with ExpressionEngine using Dotmailer
$config['email_crlf'] = "\r\n";
$config['email_newline'] = "\r\n";
$config['mail_protocol'] = 'smtp';
//The server may need to change depending on the region assigned in your Dotmailer account
//https://support.dotmailer.com/hc/en-gb/articles/212214408-Using-transactional-email#viasmtp
$config['smtp_server'] = 'r1-smtp.dotmailer.com';
$config['smtp_username'] = 'TRANSACTIONAL_EMAIL_USER';
$config['smtp_password'] = 'TRANSACTIONAL_EMAIL_PASSWORD';
$config['smtp_port'] = '25';
$config['email_smtp_port'] = '25';
@neilbradley
neilbradley / formula.md
Created August 3, 2017 10:17
Add leading Zero if a Number Starts with 7 in Google Sheets

=IF(LEFT(E2,1)="7",CONCAT("0",E2))

@neilbradley
neilbradley / feefo-export.html
Created July 28, 2017 16:17
CartThrob Feefo Order Export Template
<?php
$month_start = new DateTime("first day of last month");
$month_end = new DateTime("last day of last month");
$fn_start_on = $month_start->format('d-m-Y');
$fn_stop_before = $month_end->format('d-m-Y');
$start_on = $month_start->format('Y-m-d').' 00:00';
$stop_before = $month_end->format('Y-m-d').' 00:00';