Skip to content

Instantly share code, notes, and snippets.

View willviles's full-sized avatar
🇬🇧
Working in Birmingham, U.K.

Will Viles willviles

🇬🇧
Working in Birmingham, U.K.
View GitHub Profile
@willviles
willviles / syncTeamSupportInfo.ts
Last active January 21, 2026 21:22
Sync Team Support Info
/**
* A single flow, always initiated from the `Account` entity.
*/
async function syncTeamSupportInfo (accountId: string) {
// Get the account
const account = await getAccount(accountId)
// Return early if it doesn't contain an Enterprise team
if (!account?.planHighest === 'Enterprise') return
@willviles
willviles / .eslintrc.js
Created March 6, 2024 13:27
ESLint monorepo config
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@repo/eslint-config/base.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
},
};
⚠️ Account Zooplus PT [0011t00000ElO2XAAV] does not exist in the sandbox
⚠️ Account Zooplus [DE] [0011t00000IlUHFAA3] does not exist in the sandbox
⚠️ Account zooplus HU [0011t00000ElNreAAF] does not exist in the sandbox
⚠️ Account zooplus SK [0011t00000ElNrYAAV] does not exist in the sandbox
⚠️ Account zooplus CZ [0011t00000ElNrTAAV] does not exist in the sandbox
⚠️ Account Zooplus BE [0011t00000IlUUaAAN] does not exist in the sandbox
⚠️ Account zooplus ES [0011t00000ElNuzAAF] does not exist in the sandbox
⚠️ Account Zooplus SE [0011t00000IlUN9AAN] does not exist in the sandbox
⚠️ Account Zooplus FR [0011t00000ElOyFAAV] does not exist in the sandbox
⚠️ Account Zooplus [0011t00000IlUFFAA3] does not exist in the sandbox
@willviles
willviles / data.json
Last active November 7, 2022 17:23
Q4 Forecasts Email Stats
{
"data": {
"total": {
"delivered": 400,
"bounce": 31,
"open": 255,
"click": 85,
"_computed_": {
"openRate": 63.74999999999999,
"conversionRate": 21.25
@willviles
willviles / ppe4people-color-palette.js
Created July 14, 2020 10:23
PPE4People Color Palette
// Colors without a hex aren't yet used
function getColors () {
const colors = {
transparent: 'transparent',
'primary-shade': '#003087', // brand-dark
primary: '#005EB8', // brand
'primary-tint': '#0072CE', // brand-light
'secondary-shade': '#',
secondary: '#',
@willviles
willviles / please-do-this.json
Last active June 3, 2019 09:16
JSON:API relationships vs nested attributes. Only return records as relationships to the frontend if we need to do CRUD operations on them, otherwise we'll have too many unnecessary models in memory!
{
"data": [{
"type": "properties",
"id": "1",
"attributes": {
"geolocation": "xx,xx",
"propertyInfos": [{
"id": "123",
"value": "Shitface bastards",
"locale": "en-gb",
@willviles
willviles / in-view-ad-controller.js
Last active August 31, 2018 13:46
Quick (untested) overview of how to lazy load Prebid.js ad units on scroll using node in-view library
import inView from 'in-view'
class InViewAdController {
/**
* @func didLoadDOMContent
* @desc Hook for firing after we're sure DOM content is loaded
*/
constructor () {
this.setGlobals()
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@willviles
willviles / app-models-image.js
Last active March 8, 2017 17:19
Lux - Multiple belongs_to associations from same model
// app/models/image.js
import { Model } from 'lux-framework';
class Image extends Model {
static hasMany = {
avatars: {
model: 'image',
inverse: 'avatar' // also attempted setting `foreignKey: 'avatar_id`
@willviles
willviles / acf-font-awesome-v5.php
Created August 4, 2014 08:18
ACF5 Font Awesome Plugin
<?php
class acf_field_font_awesome extends acf_field {
/*
* __construct
*
* This function will setup the field type data
*