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 getMultipartData = (request) => { | |
| const foundKey = Object | |
| .keys(request.headers) | |
| .find(currentKey => currentKey.toLocaleLowerCase() === "content-type"); | |
| const boundary = request.headers[foundKey].split('=')[1]; | |
| const parts = request.body.split(boundary); | |
| const files = []; | |
| const fields = {}; |
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
| let suits = ["hearts", "spades", "clubs", "diamonds"]; | |
| let pickedNumber = Math.floor(Math.random() * 52); | |
| let pickedSuit = Math.floor(pickedNumber / 13); | |
| let pickedCard = {suit: suits[pickedSuit], card: pickedNumber % 13}; | |
| console.log("card: " + pickedCard.card + " of " + pickedCard.suit); |
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
| /* | |
| Cell compete: | |
| Eight houses, represented as a cells, are arranged as a straight line. | |
| Each days every cells competes with adjacent cells. An integer value 1 | |
| represents an active cell and a value of 0 represent an inactive cell. | |
| if the neigbour on both the sides of the cell are both active or inactive, | |
| the cell become inactive in the next day, otherwise the become active. | |
| The two cells on each or have a single adjacent cell, so asume that | |
| the onoccupied space in the opposite side is an inactive cell. even after | |
| updating the cell state, consider its previus state when updating the state |
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
| /* | |
| The greatest common divisor (GCD), also called the highest common factor (HCF) of N numbers | |
| is the largest positive integer that divides all numbers without giving a remainder. | |
| Write an algorithm to determin the GCD of N positive integers. | |
| https://codereview.stackexchange.com/questions/212591/find-the-greatest-common-divisor-of-n-numbers | |
| */ | |
| function generalizedGCD(num, arr) { | |
| // Use spread syntax to get minimum of array |
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"; | |
| const __FORMAT_CHECK = /^[0123456789ABCDEFGHIJKLMNOPQRSTUV]+$/; | |
| const __CHAR_MAP = '0123456789ABCDEFGHIJKLMNOPQRSTUV'.split(''); | |
| function __BASE32_ENCODE(inputData, map = null) { | |
| if (!Buffer.isBuffer(inputData)) { | |
| inputData = Buffer.from(inputData); | |
| } |
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
| //@flow | |
| import { createStore, applyMiddleware } from 'redux'; | |
| import storage from 'redux-persist/lib/storage' | |
| import { composeWithDevTools } from 'redux-devtools-extension'; | |
| import { persistStore, persistReducer } from 'redux-persist'; | |
| import thunk from 'redux-thunk'; | |
| import reducer from 'reducers'; | |
| import { createOffline } from '@redux-offline/redux-offline'; | |
| import offlineConfig from '@redux-offline/redux-offline/lib/defaults/index'; |
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
| interface IXOptions { | |
| a?: string, | |
| b?: any, | |
| c?: number | |
| } | |
| const XDefaults: IXOptions = { | |
| a: "default", | |
| b: null, | |
| c: 1 |
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
| definitions: | |
| caches: | |
| poetry-path: /root/.poetry | |
| poetry-venv: /root/.cache/pypoetry/virtualenvs | |
| steps: | |
| - step: &step-37 | |
| image: python:3.7 | |
| caches: | |
| - poetry-path |