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 "tailwindcss/tailwind.css"; | |
| import type { CodingSparkAppProps } from "modules/nextjs"; | |
| import { LayoutFactory } from "modules/ui/layouts/LayoutFactory"; | |
| import { DefaultSeo } from "next-seo"; | |
| import React from "react"; | |
| function MyApp({ Component, pageProps }: CodingSparkAppProps) { | |
| const { layout } = Component; |
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 type { CodingSparkPageLayoutProps } from "modules/nextjs"; | |
| import dynamic from "next/dynamic"; | |
| const NotAuthenticatedLayout = dynamic(() => import("modules/ui/layouts/NotAuthenticatedLayout")); | |
| const OnboardingLayout = dynamic(() => import("modules/ui/layouts/OnboardingLayout")); | |
| export const LayoutFactory: React.FC<{ layout: CodingSparkPageLayoutProps["layout"] }> = ({ | |
| layout = { type: "none" }, | |
| children, | |
| }) => { |
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 type { NotAuthenticatedLayoutArgs } from "modules/ui/layouts/NotAuthenticatedLayout"; | |
| import type { OnboardingLayoutArgs } from "modules/ui/layouts/OnboardingLayout"; | |
| import type { NextPage } from "next"; | |
| import type { AppProps } from "next/app"; | |
| interface LayoutArgs { | |
| layout?: { type: string }; | |
| } | |
| export interface CodingSparkPageLayoutProps extends LayoutArgs { |
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 { BasicStrategy as Strategy } from 'passport-http'; | |
| import { Injectable, InternalServerErrorException, UnauthorizedException } from '@nestjs/common'; | |
| import { PassportStrategy } from '@nestjs/passport'; | |
| import { ConfigService } from '@nestjs/config'; | |
| import { timingSafeEqual } from 'crypto'; | |
| @Injectable() | |
| export class AdminBasicStrategy extends PassportStrategy(Strategy) { | |
| constructor(private readonly configService: ConfigService) { | |
| super(); |
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 { yupResolver } from '@hookform/resolvers/yup'; | |
| import { useForm, UseFormProps, UseFormReturn } from 'react-hook-form'; | |
| import * as Yup from 'yup'; | |
| /** | |
| * This function is type inference ready and will auto-validate the useForm with the proper values. | |
| * | |
| * If you don't already have the schema or use a dynamic schema, consider useFormWithSchemaBuilder() | |
| * | |
| * @param schema - A valid you schema |
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 crypto from "crypto"; | |
| import merge from "lodash/merge"; | |
| import { AppConfig, PrivateConfig, PublicConfig } from "./types"; | |
| /** | |
| * Factory function that takes a public config and a HEX encrypted configuration. | |
| * On call, this function will decipher, both configuration will be merged together to provide a single JSON object representating the configuration. | |
| * | |
| * @param {PublicConfig} publicConfig | |
| * @param {string} hexEncodedPrivateConfig |
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 events = require("events"); | |
| // Vars | |
| let interestedUsers = []; | |
| const goodPlanTopic = new events.EventEmitter(); | |
| function startListeningForMessages(topic, listeningUsers) { | |
| // Each time a message is received, we sent a notification to user interest in our topic | |
| function onNewMessage(newMessage) { | |
| listeningUsers.forEach(user => |
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 firebase from "firebase/app"; | |
| import { createContext, useContext, useEffect, useState } from "react"; | |
| import { LoginPrompt } from "./components/LoginPrompt"; | |
| const AuthContext = createContext<firebase.User | null>(null); | |
| export const AuthContextProvider: React.FC = props => { | |
| const [user, setUser] = useState<firebase.User | null>(null); | |
| const [loginError, setLoginError] = useState<string | null>(null); |
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 here to bypass non-SSR issues with EUI | |
| @import "~@elastic/eui/src/theme_light.scss"; |
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 _ = require("lodash"); | |
| class CardShuffler { | |
| constructor(deck) { | |
| this.deck = _.shuffle(deck); | |
| this.activeCards = []; | |
| } | |
| /** | |
| * Get an iterator that will iterate through the cards. |
NewerOlder