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 mountReact(router, useHydrate = true) { | |
| let renderFunction = useHydrate ? hydrate : render; | |
| renderFunction( | |
| <RouterProvider router={router}> | |
| <App /> | |
| </RouterProvider>, | |
| document.getElementById('root'), | |
| ); | |
| } |
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 routerResolve from 'router5/transition/resolve'; | |
| import { withStore } from './middleware'; | |
| export function rehydrateState(router, state) { | |
| const middlewares = [withStore].map(item => item(router, router.getDependencies())); | |
| return new Promise((resolve, reject) => { | |
| routerResolve( | |
| middlewares, | |
| { |
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 transitionPath from 'router5-transition-path'; | |
| export const withStore = (router, dependencies) => async (toState, fromState) => { | |
| let stores = {}; | |
| if (fromState && fromState.stores) { | |
| stores = fromState.stores; | |
| } | |
| const { toActivate } = transitionPath(toState, fromState); |
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 App = ({route}) => { | |
| let routeMetadata = routesMap[route.name]; | |
| let Component = routeMetadata && routeMetadata.component; | |
| return <Component {...route.data} /> | |
| }; | |
| export default routeNode('')(App); | |
| // in routes | |
| const routes = [ |
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 routes = [ | |
| { | |
| name: 'home', | |
| path: '/', | |
| fetch: (state, { api }) => api.getHome(), | |
| } | |
| ] |
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 const fetchData = (router, dependencies) => async (toState, fromState) => { | |
| let toRoute = routesMap[toState.name]; | |
| if (!toRoute || !toRoute.fetch) { | |
| return toState; | |
| } | |
| toState.data = await toRoute.fetch(toState, dependencies); | |
| return toState; |
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 routes = [ | |
| { | |
| name: 'home', | |
| path: '/', | |
| }, | |
| ]; | |
| const routesToMap = routes => { | |
| let out = {}; |
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 time | |
| import socket | |
| import struct | |
| from easysnmp import Session | |
| SLEEP_DURATION = 2 | |
| session = Session(hostname='192.168.2.1', community='local', version=2) | |
| client = socket.socket(type=socket.SOCK_DGRAM) |
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
| apiVersion: autoscaling/v1 | |
| kind: HorizontalPodAutoscaler | |
| metadata: | |
| name: wongnai-react | |
| labels: | |
| app: wongnai-react | |
| spec: | |
| targetCPUUtilizationPercentage: 100 | |
| maxReplicas: 15 | |
| minReplicas: 3 |
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
| { | |
| "kind" : "Policy", | |
| "apiVersion" : "v1", | |
| "predicates" : [ | |
| {"name": "NoDiskConflict"}, | |
| {"name": "NoVolumeZoneConflict"}, | |
| {"name": "MaxEBSVolumeCount"}, | |
| {"name": "MaxGCEPDVolumeCount"}, | |
| {"name": "MaxAzureDiskVolumeCount"}, | |
| {"name": "MatchInterPodAffinity"}, |