Skip to content

Instantly share code, notes, and snippets.

View nathanchicken's full-sized avatar

Nathan Chicken nathanchicken

  • Newcastle upon Tyne
View GitHub Profile
const schemas = [
{
id: 'c5b54d6d-0c7c-473b-886f-ab18c933035a',
handle: 'horizons',
name: 'Horizons',
terms: [
'0b1c29c2-5403-4c53-b41f-2653c9dfe6c9',
'71f8c1de-21e1-4892-9933-f0a06fc78840',
'e8ac58ab-e67a-4bd4-9b1c-28888ac3a673'
]
@nathanchicken
nathanchicken / base-checkbox-matrix-with-base-checkbox.vue
Last active September 20, 2022 17:15
global-base/components/base-checkbox-matrix.vue
<template>
<div
id="matrix-wrapper"
:style="{
'--grid-rows': roles.length + 1,
'--grid-columns': entities.length + 1,
}"
>
<div>
<pre>{{ this.value }}</pre>
@nathanchicken
nathanchicken / cookie-policy.js
Last active April 29, 2020 11:19
Before minification, this is the cookie policy code in pollen8-platform-customer in authentication.html.erb
@nathanchicken
nathanchicken / app.js
Last active November 27, 2019 09:38
jQuery in webpack build for West Division / Mica
// this doesn't have to be in app.js,
// just somewhere to spin up...
const getBookings = () => import("@/parts/bookingDates")
import { docReady } from "@/libs/helpers";
docReady( () => {
// decide on what will define the presence of the jquery app,
// i.e. the presence of a particular element. If this element
@nathanchicken
nathanchicken / Example.vue
Last active October 9, 2019 14:21
Update to media-queries, makes it easier to watch for changes and you can use the media libraries for reactive data, or just use events.
<template>
<div class="p-8">
<div class="p-8 border my-8" v-if="md">md</div>
<div class="p-8 border my-8" v-if="sm">sm</div>
<div class="p-8 border my-8" v-if="lg">lg</div>
<div class="p-8 border my-8" v-if="xl">xl</div>
<div class="p-8 border my-8" v-if="xl2">xl2</div>
</div>
</template>
@nathanchicken
nathanchicken / classList.js
Created September 6, 2018 13:54
Get a classlist to sense check purge
var purgeList = [];
var container = "[data-driver-stats]";
$( container ).each( function() {
$(this).find('*').each( function() {
this.classList.forEach( l => {
if ( purgeList.indexOf( l ) === -1 ) {
purgeList.push( l );
}
})
} );
@nathanchicken
nathanchicken / onKeyboard.js
Created October 11, 2017 11:34
Helper to register keyboard events by named functions. Simple at the moment, could do with some more keywords.
(function(window, factory) {
var onKeyboard = factory(window, window.document);
window.onKeyboard = onKeyboard;
if(typeof module == 'object' && module.exports){
module.exports = onKeyboard;
}
})(window, function(window, document) {
// var keycodes = {
// left: 37,
APP.initialiser = {
// use as keywords, add to a 'global' fn queue, and decide when the 'global' queue is ready to execute.
keys: ['global', 'shop', 'photoswipe'],
statuses: {},
add: function( when, fn ) {
// you don't get to pass arguments to the init queue!
// do we have this status object?
// if not then there's no queue set thus we aren't
// expecting anything to resolve this...
@nathanchicken
nathanchicken / csv.js
Last active March 2, 2016 15:25
Parses a CSV and outputs successes and failures, based on sanitisation. Currently this is just checking for valid emails. This requires some set up and knowledge of your CSV's columns.
/**
* --------------------
* Configuration
* --------------------
*/
// CSV source
var sourceFile = "Agents_1000s.csv";