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 numpy as np | |
| import matplotlib.pyplot as plt | |
| from datetime import datetime, timedelta | |
| from prettytable import PrettyTable | |
| initial_time = 8 # 8:00 AM | |
| number_of_days = 10 | |
| minutes_after_midnight = initial_time * 60 | |
| # mean appointment time and standard deviation |
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
| // Group by region | |
| windowsRules?.reduce((acc, curr) => { | |
| const startDate = moment(curr?.options?.open_time).format('L'); | |
| if (!acc[startDate]) acc[startDate] = {}; | |
| if (!acc[startDate][curr?.region?.id]) acc[startDate][curr?.region?.id] = {}; | |
| if (!acc[startDate][curr?.region?.id].windows) | |
| acc[startDate][curr?.region?.id].windows = []; | |
| acc[startDate][curr?.region?.id].region = curr?.region; | |
| acc[startDate][curr?.region?.id].windows = [ | |
| ...acc[startDate][curr?.region?.id].windows, |
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 { useGetUserByIdQuery } from '../redux/services/movesApi'; | |
| // Hook to provide wrappers for new features. | |
| // Wrap new components in the NewFeatureWrapper to only show them to users who have opted in to the beta. | |
| // Wrap original code in the DefaultFeatureWrapper for users who have not opted in. | |
| // | |
| // Example: | |
| // import {NewFeatureWrapper, DefaultFeatureWrapper} from './FeatureFlags'; | |
| // ... | |
| // <NewFeatureWrapper feature="newFeature"> |
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
| // return an array of unique objects | |
| const getUniqueArray = (array: any) => { | |
| const objectsEqual = (obj1: any, obj2: any) => { | |
| let notEqual = false; | |
| const keys = obj1 && Object.keys(obj1); | |
| for (const key of keys) { | |
| if (obj2[key] !== obj1[key]) { | |
| notEqual = true; | |
| break; | |
| } |
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 getOrdinal = number => { | |
| const b = number % 10; | |
| const c = number % 100; | |
| const exceptions = [11, 12, 13]; | |
| switch (true) { | |
| case exceptions.includes(c): | |
| return number + 'th'; | |
| case b === 1: | |
| return number + 'st'; | |
| case b === 2: |
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
| for (let j = 0; j < 4; j++) { | |
| let sum = 0 | |
| sum = (arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + arr[i + 1][j + 1] + arr[i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2]) | |
| } |
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
| { | |
| "users": [ | |
| { "id": "23", "firstName": "Bill", "age": 20, "companyId": "1" }, | |
| { "id": "34", "firstName": "John", "age": 27, "companyId": "2" }, | |
| { "id": "47", "firstName": "Samantha", "age": 21, "companyId": "2" } | |
| ], | |
| "companies": [ | |
| { "id": "1", "name": "Apple", "description": "iphone" }, | |
| { "id": "2", "name": "Google", "description": "search" } | |
| ] |
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 express = require('express') | |
| const expressGraphQL = require('express-graphql') | |
| const schema = require('./schema/schema') | |
| const app = express() | |
| app.use('/graphql', expressGraphQL({ | |
| schema, | |
| graphiql: true | |
| })) |
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 express = require('express') | |
| const expressGraphQL = require('express-graphql') | |
| const schema = require('./schema/schema') | |
| const app = express() | |
| app.use('/graphql', expressGraphQL({ | |
| schema, | |
| graphiql: true | |
| })) |
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 graphql = require('graphql') | |
| const axios = require('axios') | |
| const { | |
| GraphQLObjectType, | |
| GraphQLString, | |
| GraphQLInt, | |
| GraphQLSchema, | |
| GraphQLList | |
| } = graphql; |
NewerOlder