Skip to content

Instantly share code, notes, and snippets.

View davevanfleet's full-sized avatar

Dave Van Fleet davevanfleet

View GitHub Profile
{
"dependencies": {
"@emotion/core": "^10.0.10",
"@emotion/react": "^11.7.0",
"@emotion/styled": "^11.6.0",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/pickers": "^3.2.10",
/// <reference types="cypress" />
import me from '../fixtures/me'
import allExercises from '../fixtures/allExercises'
import exercise from '../fixtures/exercise'
import workoutPlan from '../fixtures/workoutPlan'
import suggestedMeals from '../fixtures/suggestedMeals'
const MOCK_RESPONSES = {
Me: me,
/// <reference types="cypress" />
describe('Excersises List Page', () => {
beforeEach(() => {
cy.intercept('POST', 'http://localhost:4000/graphql', (req) => {
if (req.body.operationName === 'AllExercises') {
req.reply({
statusCode: 200,
body: {
excersises: [
export const GET_ALL_EXERCISES = gql`
query AllExercises($input: ExerciseQueryInput) {
exercises(input: $input) {
id
name
description
muscles_targeted {
id
name
}
/// <reference types="cypress" />
describe('Excersises List Page', () => {
beforeEach(() => {
cy.intercept('GET', 'http://localhost:8080/excersises', {
statusCode: 200,
body: {
excersises: [
{
name: "Pull Up",
import React from 'react';
import { TeamsProvider } from 'context/teamContext';
const App = () => (
<TeamsProvider>
<Layout>
<AppRouter />
</Layout>
</TeamsProvider>
);
import React from 'react';
import { useTeamContext } from 'context/teamContext';
const SelectTeam = () => {
const { team, setTeam, allTeams } = useTeamContext();
const handleChange = (e) => {
setTeam(e.target.value);
};
import React, { createContext, useContext, useEffect, useState } from 'react';
import { useQuery } from 'react-query';
const TeamContext = createContext({
isLoading: false,
team: undefined,
setTeam: undefined,
allTeams: [],
});
import { useMutation, useQuery } from 'react-query';
import React from 'react';
import axios from 'axios';
const NotificationsDrawer = () => {
const {notifications, markAsRead } = useNotifications()
return (
<Drawer>
{notifications.map(notifcation => (
<NotificationCard notification={notification} markAsRead={markAsRead} />
const sumOfTwoNumbers = (arr, target) => {
// sort the array in asc order so we can use a sliding window technique to find sum
arr.sort((a, b) => a - b)
// use two pointers to implement a sliding window technique on sorted array
// if we never equal the target sum and the pointer cross, there is no suitable pair
let leftPointer = 0;
let rightPointer = arr.length - 1;
const sumLessThanTarget = () => arr[leftPointer] + arr[rightPointer] < target