This file contains 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
{ | |
"order_groups":{ | |
"323534":{ | |
"order_ids":[ | |
444788 | |
], | |
"log_ids":[ | |
2550087, | |
2550068, | |
2550501 |
This file contains 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
SHOW_INFO_ICON = $(shell printf "\033[34;1m▶\033[0m") | |
SHOW_SUCCESS_ICON = $(shell printf "\033[32;1m✔\033[0m") | |
.PHONY: test | |
test: setup_env | |
$(info $(SHOW_INFO_ICON) Initializing test ...) | |
@echo 'test test test' | |
$(info $(SHOW_SUCCESS_ICON) Test complete) | |
This file contains 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 unsortedListOfNumbers = [5, 13, 3, 0, 1, 89, 1, 21, 34, 2, 55, 8]; | |
const TIMEOUT_PADDING = 50; | |
const sleepSort = async listOfNums => { | |
const result = []; | |
const promises = listOfNums.map( | |
num => | |
new Promise(resolve => { | |
setTimeout(() => { | |
result.push(num); |
This file contains 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
import isPlainObject from 'lodash/isPlainObject'; | |
function canTraverseNodes(obj) { | |
return isPlainObject(obj) || (Array.isArray(obj) && isPlainObject(obj[0])); | |
} | |
function getAllPaths(obj, basePath = '', paths = []) { | |
if (!canTraverseNodes(obj)) { | |
return paths; | |
} |
This file contains 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 | |
/** | |
* Boss Pro | |
* | |
* This file adds functions to the Boss Pro Theme. | |
* | |
* @package Boss | |
* @author Bloom | |
* @license GPL-2.0+ | |
* @link http://my.studiopress.com/themes/boss/ |
This file contains 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 isCardNumberValid = cardNumber => { | |
const normalizedStr = cardNumber.replace(/\s/g, ''); | |
const tokens = Array.from(normalizedStr).map(Number); | |
const checkDigit = tokens.pop(); | |
const nonCheckDigitsSum = tokens | |
.reverse() | |
.reduce((sum, token, i) => { | |
if (!(i % 2)) { | |
const strigifiedDouble = (token * 2).toString(); |
This file contains 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
Array.prototype.xreduce = myReduce; | |
function myReduce (action, defaultValue) { | |
var result = []; | |
var isObject = typeof defaultValue === 'object'; | |
var initialAccVal = isObject ? (defaultValue.constructor === Object ? {} : []) : defaultValue; | |
var acc = isObject ? Object.assign(initialAccVal, defaultValue) : defaultValue; |
This file contains 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
Array.prototype.xfilter = myCustomArrayFilter; | |
function myCustomArrayFilter (action) { | |
var result = []; | |
for (var i = 0; i < this.length; i++) { | |
var args = [this[i], i, this]; | |
if (action.apply(null, args)) { | |
result.push(this[i]); | |
} | |
} |
This file contains 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
Array.prototype.xmap = myCustomArrayMap; | |
function myCustomArrayMap (action) { | |
var result = []; | |
for (var i = 0; i < this.length; i++) { | |
var args = [this[i], i, this]; | |
result.push(action.apply(null, args)); | |
} | |
return result; | |
} |
This file contains 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
#### Models | |
user: | |
fields: | |
id: | |
type: string | |
required: true | |
requestType: | |
type: string | |
enum: [first-user, new-user, client-vip] | |
required: true |
NewerOlder