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 GAP_WALK_TASK_STATE_MACHINE_ID = "gapWalkTask" | |
const createGapWalkMachine = taskContext => | |
Machine( | |
{ | |
strict: true, | |
id: GAP_WALK_TASK_STATE_MACHINE_ID, | |
initial: 'toDo', | |
context: { |
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
import { useEffect, useState } from 'react'; | |
import { Keyboard } from 'react-native'; | |
export const useBackHandler = () => { | |
const [isOpen, setOpen] = useState(false); | |
useEffect(() => { | |
const keyBoardShowListener = Keyboard.addListener('keyboardDidShow', () => setOpen(true)); | |
const keyBoardHideListener = Keyboard.addListener('keyboardDidHide', () => setOpen(false)); | |
return () => { | |
keyBoardShowListener.remove(); |
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
provider "fastly" { | |
api_key = "${var.fastly_apikey}" | |
} | |
resource "fastly_service_v1" "iot_main" { | |
name = "IoT main service ${var.environment_tag}" | |
domain { | |
name = "${var.fastly_domain}" | |
} |
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
import findShortestWay, { Matrix } from './algorithm'; | |
/** | |
* To test this algorithm for finding the shortest way | |
* from the client location to target server location | |
* we can show abstractly pull of servers as an undirected graph. | |
* | |
* As undirected graph we can use simple randomly filled grid or matrix. | |
* | |
* Matrix cell filled with "1" means as unavailable server |
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
export type MatrixLocation = Array<number>; | |
export type Matrix = Array<Array<number>>; | |
/** | |
* This function describes possible algorithm to find | |
* the shortest way from client to server | |
* | |
* @param serverMatrix - matrix of available servers | |
* @param client - initial client location | |
* @param server - target server location |