Skip to content

Instantly share code, notes, and snippets.

View get-all-features-for-single-vin.sql
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 May 4, 2019
Technical Screen - Front-end Developer
View gist:115a0fec6766a7592d7a66d48e915d3c
/**************\
* 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 Sep 1, 2017
Some testing code to generate proper eosd API calls.
View eos-api.js
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,
View logo-type_color.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@datchley
datchley / QEvBwg.markdown
Last active Jul 5, 2016 — forked from anonymous/QEvBwg.markdown
Responsive: Higher Order Component to pass width/height to Components as props
View QEvBwg.markdown
@datchley
datchley / async-generator-runner.js
Created Feb 24, 2016
A runner for creating async generators for various types of sources
View async-generator-runner.js
// 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 Jan 22, 2016
Various bash snippets I've used in scripts
View bash-snippets.bash
#!/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 Dec 8, 2015
Conversions for Integers <-> Roman Numerals
View romans.js
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 Nov 24, 2015
Tail Call Optimization on the fly for tail recursive functions in Javascript (naive implementation)
View tco.js
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);