Skip to content

Instantly share code, notes, and snippets.

View kylewelsby's full-sized avatar
🎯
Focusing

Kyle Welsby kylewelsby

🎯
Focusing
View GitHub Profile
@kylewelsby
kylewelsby / 20230504090000_tracks.sql
Last active May 17, 2023 11:05
Slugify and Pathify
CREATE TABLE public.artists (
title character varying NOT NULL,
slug character varying NOT NULL,
id SERIAL PRIMARY KEY -- I use a different ID technique
);
ALTER TABLE public.artists OWNER TO postgres;
CREATE TABLE public.tracks (
export default {
// ...
serverMiddleware: [
{ path: '/api/supabase', handler: '~/server-middleware/supabase.mjs' },
],
// ...
}
@kylewelsby
kylewelsby / machine.js
Created December 30, 2020 19:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kylewelsby
kylewelsby / 7.md
Created July 15, 2020 23:01
soulection show 7 example

artwork: images/episodes/7.jpg date: '2011-02-15 00:00:00 +0000' episode: 7 sessions:

  • name: Joe Kay's Session tracks:
    • Velour - Booty Slammer
    • Flying Lotus - Untitled
  • Lykkle Li - I Follow River (The Creator Remix)

location: UK station: beats1 date: '2020-07-04T00:00:00.000Z' duration: 7292 sessions:

  • name: ROMderful's Takeover Session tracks:
    • KayFaraway - 10th Wonder (feat. Romderful)
  • Dr. Dome - One More Chance
<?xml version="1.0"?>
<office:document-content xmlns:officeooo="http://openoffice.org/2009/office" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.
var links = []
links.push({
title: "Best Offers",
href: "/offers"
})
links.forEach(link => {
console.log(`<a href="${link.href}">${link.title}</a>`)
})
@kylewelsby
kylewelsby / array-flatten.js
Last active November 5, 2018 11:15
Super simple polyfill for Array#flat
/** Super simple Polyfill for Array#flat
* @experimental
* @interface
* Supports ie9+, chromeAll, firefox4+, safari5+, opera10.5+
* Add https://github.com/es-shims/es5-shim to your project to support older browsers
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
*/
/**
* flattens array
@kylewelsby
kylewelsby / example.rb
Last active April 27, 2017 08:25
The ability to generate an ULID from a legacy integer ID. Useful for syncing data between systems.
require 'time'
class User
def id
'507f1f77bcf86cd799439011'
end
def created_at
Time.parse('2017-04-24 12:15:20 +0200')
end
end