Skip to content

Instantly share code, notes, and snippets.

View johnorourke's full-sized avatar

John O'Rourke johnorourke

View GitHub Profile
@johnorourke
johnorourke / elevators.js
Created December 11, 2020 18:17
Elevator fun
const o = {
init: function(lifts, floors) {
/*
aim: get a lift to waiting people quickly, get people to their floor quickly
get a lift to waiting people quickly:
- nearest lift
- which isnt full
- already got this floor in its queue
- floors in its queue which are in the direction the user wants to go
#!/bin/bash
set -euo pipefail
err() {
echo $1 >>/dev/stderr
rm -f $TMP_SNAPSHOT_FILE
exit 3
}
trap "err 'Error while running monitoring commands'" ERR
<?php
// namespace should be just the module eg. GetJohn\\PunchoutHub
const API_NS = 'Api\Data'; // path to api data models
const MODEL_NS = 'Model'; // path to models
if(!file_exists('composer.json'))
{
throw new \Exception('must be run from the root of your module');
@johnorourke
johnorourke / add-store-id-to-cms-api.patch
Created January 3, 2019 07:36
Patch to add store_id support to CMS API Block and Page interface
diff --git Api/Data/BlockInterface.php Api/Data/BlockInterface.php
index 68110b5..353dae8 100644
--- Api/Data/BlockInterface.php
+++ Api/Data/BlockInterface.php
@@ -22,6 +22,7 @@ interface BlockInterface
const CREATION_TIME = 'creation_time';
const UPDATE_TIME = 'update_time';
const IS_ACTIVE = 'is_active';
+ const STORE_ID = 'store_id';
/**#@-*/