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 dayOfMonth = d => `${d.getDate()}/${d.getMonth()}/${d.getFullYear()}`; | |
| const midnightDistance = d => Math.abs(realMidnightDistance(d)); | |
| const realMidnightDistance = d => (d.getHours() - 12) > 0 ? -midnightDistancePM(d) : midnightDistanceAM(d); | |
| const midnightDistanceAM = d => (d.getHours() * 60) + d.getMinutes(); | |
| const midnightDistancePM = d => ((24 - d.getHours()) * 60) - (60 - d.getMinutes()); | |
| const excludeDistLessThan = threshold => d => realMidnightDistance(d) > threshold; | |
| const closestToMidnight = d => |
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
| { | |
| "version": 1, | |
| "hash": "b657e22827039461a9493ede7bdf55b01579254c1630b0bfc9185ec564fc05ab", | |
| "block_height": 477230, | |
| "inputs": [ | |
| { | |
| "n": 0, | |
| "address": "1GLctvTi81GDYZF5F6nif2MdbxUnAGHATZ", |
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 _ = require('lodash'); | |
| function getEquationVariables(equation) { | |
| variables = equation.match(/[a-z]/g); | |
| return _.chain(variables).compact().uniq().value(); | |
| } | |
| function getAllVariables(equations) { | |
| return _.chain(equations) | |
| .map(getEquationVariables) |
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 path = require('path'); | |
| const chalk = require('chalk'); | |
| const fileToTest = process.argv[2]; | |
| if(!fileToTest) throw new Error('define the file to test'); | |
| let PADDING = -4; | |
| let success = 0; | |
| let fails = 0; | |
| function describe(suite, fn = function(){}) { |
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 symbolToMorse = { | |
| a: '.-', | |
| b: '-...', | |
| c: '-.-.', | |
| d: '-..', | |
| e: '.', | |
| f: '..-.', | |
| g: '--.', | |
| h: '....', | |
| i: '..', |
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
| function getLastDigit(n) { | |
| const n10 = n/10; | |
| return Math.round((n10 - Math.floor(n10)) * 10); | |
| } | |
| function removeLastDigit(n) { | |
| return parseInt((n - getLastDigit(n))/10); | |
| } | |
| function splitDigits(n) { |
OlderNewer