- "He who quotes others is an idiot" - Thomas Jefferson
- "Wine we need for health, and the health we need to drink vodka." - Viktor Chernomyrdin
- "To answer before listening -- that is folly and shame." - Proverbs 18:13
- "Some name it disappointment and become poorer, others name it experience and become richer" - Siegmund Warburg
- "If we want to fully experience love and belonging, we must believe that we are worthy of love and belonging." - Brene Brown
- In some ways suffering ceases to be suffering at the moment it finds a meaning, such as the meaning of a sacrifice." - Viktor Frankl
This file contains hidden or 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
<?php | |
$sorted_arr = function ($range_to_sort) { | |
// Annoyingly, PHP can't return the sorted array from a sort | |
// Do it manually | |
usort($range_to_sort, function ($a, $b) | |
{ |
This file contains hidden or 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
def free_times(calendar_list): | |
output = [] | |
# This is easier with a list sorted by start time | |
# sort() is mergesort, with O(n) = n log n | |
# which is fast enough to not manually sort. | |
calendar_list.sort(key = lambda event: event[0]) | |
for index in range(len(calendar_list)): | |
if (index > 0): |
This file contains hidden or 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
from functools import reduce | |
def merge_arrays(accumulator, new): | |
# Since Python doesn't have multiline lambdas | |
# we define our reducer function here | |
last = len(accumulator) - 1 | |
if (new[0] <= accumulator[last][1]): | |
start = accumulator[last][0] |
This file contains hidden or 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
'use strict'; | |
function reducer(array, callback, initializer) { | |
let accumulator = (initializer === undefined) ? 0 : initializer; | |
for (let i = 0; i < array.length; i++) { | |
accumulator = callback(accumulator, array[i]); | |
} | |
return accumulator; |
This file contains hidden or 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
pick 019325e 0.1.0 | |
pick a4b689d Fetch all dependencies | |
squash 714a49d Matches keywords to Docker repos | |
pick d2d1ca3 parseDependencies returns an object of dependencies. | |
squash e3b6cd9 Clean up packageParser | |
squash 57acd67 Initial commit | |
squash 3f3e05e Rough out how we'll make Dockerfiles | |
squash 9e10b94 Can check for, make Docker files | |
squash a27b0ee Write docker files | |
pick a0980b8 Build Dockerfiles |
This file contains hidden or 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
const minty = require('./index.js'); | |
const path = require('path'); | |
function hello(a,b,c) { | |
console.log(a); | |
var d = b + c; | |
console.log(d); | |
} | |
minty.file(path.join(__dirname, '/lib/test.js')); |
Sometimes, I want to know what's fast. Usually I google it. But, in the below cases, I decided I needed to try it myself.
- Fastest Factorial - what's the cost of doing it recursively? Turns out While is 10x faster.
- Fastest way to find type - instanceof seems good. JQuery uses constructor. Prototype.toString is probably the most safe and compatible.
- Speed of Sorts, when written as recursive or using a while loop.
This file contains hidden or 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
/* --------------------------------------------------------------------------- */ | |
// Utility Functions | |
function dequote(str) { | |
// We need to remove excess quotes | |
// This seems hacky but I've run through a bunch of test cases and it appears to be what's needed | |
var newstring; | |
// Replace any escaped quotes | |
newstring = str.replace(/\\"/g, '"'); | |
// The whole string will be wrapped in quotes. Unwrap. |
This file contains hidden or 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
(?:1[\-\s])?(?:\(?(\d{3})[\-\)\s]?(?:[\s\.])?)?\d{3}[-\s\.]\d{4} |