Skip to content

Instantly share code, notes, and snippets.

// Add unique partial urls to this list and the Chatbot will automatically open on them
const pagesWithChatbotOpen = [
"Instant-help-with-our-chatbot",
// "Give-us-a-call",
];
const delay = 2500; // 500ms = 0.5s
const urlIsInList = pagesWithChatbotOpen.filter(page => location.pathname.includes(page)).length > -1;
document.addEventListener("DOMContentLoaded", () => {
-- Get all of today's rides that have no riders
SELECT r.id from Ride r
LEFT OUTER JOIN (
SELECT rideId, CAST(count(*) as UNSIGNED) cnt
FROM UsersOnRides
GROUP BY rideId
) ur ON ur.rideId = r.id
where DATE_FORMAT(r.date,'%d/%m/%Y') = DATE_FORMAT(NOW(),'%d/%m/%Y')
and COALESCE(ur.cnt,0) = 0;
type LogLevel = "log" | "info" | "error" | "debug" | "warning";
class Logger {
constructor() {
this.module = console;
}
format(message: string, level: LogLevel = "log"): string {
const dateTime = new Date().toISOString();
return JSON.stringify({ time: dateTime, level, message });
@airburst
airburst / story.sh
Last active January 14, 2022 15:54
Simple CLI to create Jira issue stub
#!/bin/bash
##################################################################
# Step 1: Sign in to Jira and create an API token at this link:
# https://id.atlassian.com/manage-profile/security/api-tokens
#
# Step 2: Create a file named ~/.jiraconfig and add the following:
# JIRA_USER={fname.lname@simplybusiness.co.uk}
# JIRA_API_TOKEN={your-api-token}
# JIRA_PROJECT_KEY={jira-project-key} e.g. FETT
@airburst
airburst / sequenceWithResultStore.js
Created June 13, 2018 11:11
Run an async queue of records through an action and store/use result of each
class TaskQueue {
constructor(concurrency = 1) {
this.concurrency = concurrency;
this.running = 0;
this.queue = [];
}
pushTask(task) {
this.queue.push(task);
this.next();