Skip to content

Instantly share code, notes, and snippets.

View MichaelrMentele's full-sized avatar
👨‍💻

Michael Mentele MichaelrMentele

👨‍💻
View GitHub Profile
# app.ts
import path from 'path'
import { config } from 'dotenv-defaults'
import express from 'express'
import { setup as setupAdminJS } from './adminjs/setup'
import { setup as setupBullBoard } from './bullboard/setup'
import { useMutation } from '@apollo/client'
import lodash from 'lodash'
import {
CreateLienholderInput,
CreateLienholderMutation,
CreateLienholderMutationVariables,
DeleteLienholderMutation,
DeleteLienholderMutationVariables,
FindLienholdersQuery,
Lienholder,
```yaml
e2e-tests:
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving Cypress Cloud hanging ...
api | "TransactionKey": "4fb3b654c2e14dad8554f0a525143283",
api | "ActionResult": {
api | "ArrayOfMessageDetail": {
api | "MessageDetail": {
api | "Severity": "Error",
api | "Source": "Carleton.Connect.Plugins.CarletonDocs.GetPrintDocumentsConnector",
api | "Code": "GetPrintDocumentsConnector.CC001",
api | "Text": "An unhandled exception was caught: FDD file \\\\amznfsxj1gdmggk.carletoncolo.local\\share\\CarletonConnect\\ClientFiles\\LeftLane\\CarletonDocs\\LEFTLANE_AUTH_LIEN_PAYOFF.fdd does not exist.",
api | "Data": "System.IO.FileNotFoundException: FDD file \\\\amznfsxj1gdmggk.carletoncolo.local\\share\\CarletonConnect\\ClientFiles\\LeftLane\\CarletonDocs\\LEFTLANE_AUTH_LIEN_PAYOFF.fdd does not exist.\n at Carleton.Docs.DocForm.ReadFDD(String name)\n at Carleton.Docs.DocForm..ctor(String name, Int32 defCopies, Int32 minCopies, Int32 maxCopies, Boolean req, String desc, DocSet& ds, String baselineName, Boolean listOnly)\n at Carleton.Docs.DocSet.Re
export const comments: QueryResolvers['comments'] = async ({
parentType,
parentId,
}) => {
const commentable = parentType[0].toLowerCase() + parentType.substring(1)
validateWith(() => {
if (!Object.values(Commentable).includes(commentable)) {
throw new Error(
'Invalid commentable passed in, check your value for parentType'
Summary of all failing tests
FAIL src/pages/PipelinePage/PipelinePage.stories.tsx (9.338 s)
● Pages/PipelinePage › forDeals › smoke-test
TypeError: Cannot read properties of undefined (reading 'toString')
at http:/localhost:7910/main.iframe.bundle.js:108708:29
at Array.map (<anonymous>)
at http:/localhost:7910/main.iframe.bundle.js:108707:53
at Array.forEach (<anonymous>)
@MichaelrMentele
MichaelrMentele / JSIdiomsQuiz.js
Created August 11, 2022 14:59
Quiz for writing more idiomatic JS code
// 1. how would you refactor this function signature? what is problematic about it?
const someFunc = (A, B, C, D = 3, E, F, G = 'default') => { ... }
// 2. see below
myString = "Some string."
b = myString[myString.length - 1] // -> b = myString.slice(-1)
@MichaelrMentele
MichaelrMentele / useEffectQuiz.js
Last active August 11, 2022 14:47
Use effect basics
// 1. when will this useEffect render?
const SomeComponent = () => {
useEffect(() => {
console.log('useEffect')
})
return null
}
// 2. how do you render a use effect once and not on re-renders?
src/services/floorPlans/floorPlans.ts:27:9 - error TS2322: Type 'CurtailmentCreateNestedManyWithoutFloorPlanInput' is not assignable to type '(Without<CurtailmentCreateWithoutFloorPlanInput, CurtailmentUncheckedCreateWithoutFloorPlanInput> & CurtailmentUncheckedCreateWithoutFloorPlanInput) | ... 6 more ... | (Without<...> & CurtailmentCreateWithoutFloorPlanInput[])'.
27 create: input.curtailments,
~~~~~~
../node_modules/.prisma/client/index.d.ts:10597:5
10597 create?: XOR<Enumerable<CurtailmentCreateWithoutFloorPlanInput>, Enumerable<CurtailmentUncheckedCreateWithoutFloorPlanInput>>
~~~~~~
The expected type comes from property 'create' which is declared here on type 'CurtailmentUncheckedCreateNestedManyWithoutFloorPlanInput | CurtailmentCreateNestedManyWithoutFloorPlanInput'
// this works
import CommentForm from './CommentForm'
export const generated = () => {
mockGraphQLMutation('CreateCommentMutation', (variables, { ctx }) => {
const id = parseInt(Math.random() * 1000)
ctx.delay(1000)
return {