Skip to content

Instantly share code, notes, and snippets.

@tmcgann
tmcgann / fizzbuzz.js
Created October 27, 2016 20:21
Iterative solutioning to classic FizzBuzz problem with goal of elegance (minimal state, branching, etc.)
// Inspired by: https://klipse.ghost.io/the-most-elegant-implementation-of-fizzbuzz/
// I read the first couple paragraphs of the post and before looking at the solution, I started working on the FizzBuss problem as stated in the article. I've copied it here for convenience:
//
// Write a program that prints the numbers from 1 to 100.
// But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”.
// For numbers which are multiples of both three and five print “FizzBuzz”.
// What follows is my iterative solutioning before viewing the solution:
// const numbers = Array.from(Array(100), (value, index) => index + 1);
@tmcgann
tmcgann / promisePlayground.js
Created October 24, 2016 21:45
Playing with some promise logic
function make(timeout=3000) {
const TIMEOUT = timeout;
let promise = null;
let data1 = {
currentCommunity: {
name: 'Dwelo',
},
currentUser: {
name: 'taylor',