Skip to content

Instantly share code, notes, and snippets.

View plfx's full-sized avatar

Jeremy Coffield plfx

View GitHub Profile
@plfx
plfx / calendar.js
Last active November 7, 2019 20:16
Appointment Scheduling code exercise
class Calendar {
constructor() {
}
addAppointment(startTime, duration) {
// TODO: Add an appointment beginning at timestamp "startTime" and lasting for "duration"
// Throw an error if the time is not available
}
checkAvailability(startTime, duration) {
@plfx
plfx / deptree.js
Last active February 2, 2018 15:47
dag / deptree resolver with parallelism
class DepTree {
constructor() {
this.nodes = {}
this.error = null
}
add(before, after) {
if (this.error != null) {
throw this.error
}
@plfx
plfx / FixLegacyMySQLOauthCodeColumn.sql
Last active March 31, 2017 21:26
Work-around for migration V4_0_3__Add_Index_To_Oauth_Code failure
-- Prior to UAA 1.5.2, the UAA schema would create the oauth_code.code column as
-- VARCHAR(256). A recent migration V4_0_3__Add_Index_To_Oauth_Code attempts to
-- add a unique index to this column to improve lookup speed, but the VARCHAR(256)
-- column in these long-lived UAA databases is too large for InnoDB to uniquely
-- index. If your deployment experiences failure in the UAA job when updating to
-- CF v255, this manual intervention should repair the UAA database by resizing
-- the column so that the migration can succeed on the next attempt.
DELETE FROM schema_version WHERE version = '4.0.3';
ALTER TABLE oauth_code MODIFY code VARCHAR(255);