Skip to content

Instantly share code, notes, and snippets.

WITH all_builds AS (
/*
* Set this up as a Materialized View after each "sync" process
* which allows querying by VIN # or build_id
*/
SELECT
'Base' as type,
s.header as header,
s.description as description,
null as value,
@datchley
datchley / gist:115a0fec6766a7592d7a66d48e915d3c
Last active August 4, 2022 15:41
Technical Screen - Front-end Developer
/**************\
* Algorithms *
\**************/
// Given an array of objects summarizing the number of fish in an aquarium,
// find the percent of fish where the species is unknown (the `species` is
// `undefined`). Return the percentage as a whole number between `0` and `100`.
// Example input:
@datchley
datchley / eos-api.js
Created September 1, 2017 17:20
Some testing code to generate proper eosd API calls.
const fetch = require('isomorphic-fetch');
function pad(number) {
if (number < 10) {
return '0' + number;
}
return number;
}
// eosd currently has issues with "real" ISO time format,
@datchley
datchley / logo-type_color.svg
Created June 15, 2017 19:05
tandem.ly logo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@datchley
datchley / react-redux-style-guide.md
Last active February 13, 2024 14:30
React + Redux Style Guide
@datchley
datchley / QEvBwg.markdown
Last active July 5, 2016 16:41 — forked from anonymous/QEvBwg.markdown
Responsive: Higher Order Component to pass width/height to Components as props
@datchley
datchley / async-generator-runner.js
Created February 24, 2016 15:09
A runner for creating async generators for various types of sources
// Sources...
let arr = [1,2,3,4];
// thunk returning function that takes a callback
// and applies the arg to it after ms milliseconds timeout
function delay(arg, ms=1000) {
return function(callback) {
setTimeout(_=>callback(arg), ms);
};
}
@datchley
datchley / bash-snippets.bash
Created January 22, 2016 17:16
Various bash snippets I've used in scripts
#!/bin/bash
# disable builtin echo so we can use '-en'
enable -n echo
SCRIPT=$(basename "$0")
SCRIPT_DIR=$(dirname "$0")
echo "$SCRIPT running from $SCRIPT_DIR"
# Determine if we're interactive or not
@datchley
datchley / romans.js
Created December 8, 2015 05:20
Conversions for Integers <-> Roman Numerals
function int2roman(n) {
var map = [
{ factor: 1000, letter: 'M' },
{ factor: 900, letter: 'CM' },
{ factor: 500, letter: 'D' },
{ factor: 400, letter: 'CD' },
{ factor: 100, letter: 'C' },
{ factor: 90, letter: 'XC' },
{ factor: 50, letter: 'L' },
{ factor: 40, letter: 'XL' },
@datchley
datchley / tco.js
Created November 24, 2015 21:59
Tail Call Optimization on the fly for tail recursive functions in Javascript (naive implementation)
function range(s, e, res) {
if (!res) { res = []; }
res.push(s);
if (s == e ) {
return res;
}
else {
if (s<e) { s++; }
else { s--; }
return range(s, e, res);