View sparse_timeseries.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PostgreSQL 14 | |
SELECT | |
days AS observation_date, | |
-- Explicitly coalescing missing values to zero. | |
-- This logic will be use case-dependent. | |
coalesce(metrics.metric, 0) AS metric | |
FROM | |
-- Replace this with the dense metrics table | |
(values ('2023-01-01'::date, 111111), ('2023-06-15'::date, 222222)) AS metrics (observation_date, metric) |
View example.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @typedef {{name: string; title: string; description: string; sets: any[]; }} Workout */ | |
/** @typedef {{name: string; instructions: string;}} Exercise */ | |
/** @typedef {"en" | "fr" | "de" | "jp" | "zh" | "he"} Lang */ | |
/** @typedef {string | {[L in Lang]?: string}} Message */ | |
/** @typedef {{for: string, message?: Message}} ValidationResult */ | |
/** | |
* @template Entity | |
* @typedef {{(condition: {(entity: Entity): boolean}, id: string, message: Message): {(entity: Entity): ValidationResult[]}}} RuleCreator<Entity> |
View timer.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svg { | |
display: inline-block; | |
height: 90px; | |
width: 90px; | |
} | |
svg.timer { | |
transform: rotate(-90deg); | |
overflow: visible; | |
} | |
circle.gague { |
View fy-date-converter.xlsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
="FY"&IF(MONTH(G2)=1, YEAR(G2), YEAR(G2)+1) & "Q"&IF(MONTH(G2)=1, 4, FLOOR((MONTH(G2)+1)/3,1)) |
View split-json-array.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Splits a file that contains a top-level JSON Array | |
# into individual files, one per item, named sequentially | |
# https://stedolan.github.io/jq/download/ | |
jq -c .[] "$1" | awk '{print > (NR ".json")}' |
View transform.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* Depth-first copy with selective transformation. | |
* For each of the `Iterable` selected by the selector function, it | |
* applies the `visitor` function and continues recursively. | |
* | |
* | |
* @param {object} node the tree structure | |
* @param {function} [visitor] the function to apply to selected children |
View values.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/jmakeig/iterant/issues/30 | |
function head(itr) { | |
if (itr[Symbol.iterator]) return itr[Symbol.iterator]().next().value; | |
} | |
function* values(ref, options) { | |
const sequence = cts.values(ref, options); | |
for (const value of sequence) { | |
yield { | |
value: value.valueOf(), |
View table.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Progenitor Mock-up</title> | |
<style type="text/css"> | |
table { | |
position: relative; /* Needed for sticky headers */ | |
width: 100%; |
View machine.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import { Machine, assign } from './xstate.js'; | |
// Ensure correct dirty checks when Svelte is running in immutable mode. | |
function clone(object) { | |
if ('object' === typeof object) { | |
if (null === object) return object; | |
if (Array.isArray(object)) return [...object]; | |
if (object instanceof Set) return new Set(object); | |
if (object instanceof Map) return new Map(object); | |
return Object.assign({}, object); |
View nested-tables.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Nested Tables</title> | |
<style> | |
html { | |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, | |
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; | |
font-size: 14px; |
NewerOlder