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
| // amplify/data/backend.ts | |
| import { type ClientSchema, a, defineData } from "@aws-amplify/backend"; | |
| import { createUserResolver } from "../functions/create-user-resolver/resource"; | |
| const schema = a.schema({ | |
| // Custom mutation for creating users | |
| createUser: a | |
| .mutation() | |
| .arguments({ |
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
| // amplify/backend.ts | |
| import { defineBackend } from "@aws-amplify/backend"; | |
| import { auth } from "./auth/resource"; | |
| import { data } from "./data/resource"; | |
| import { PolicyStatement, Effect } from "aws-cdk-lib/aws-iam"; | |
| import { | |
| RestApi, | |
| LambdaIntegration, | |
| AuthorizationType, | |
| CognitoUserPoolsAuthorizer, |
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
| # Configure AWS CLI | |
| select_aws_profile() { | |
| echo "Available AWS Profiles:" | |
| PS3="Select AWS profile (enter number): " | |
| # Get profiles directly using grep and sed | |
| profiles=($(grep '^\[profile' ~/.aws/config | sed 's/\[profile \(.*\)\]/\1/') "Skip") | |
| select profile in "${profiles[@]}"; do | |
| [[ "$profile" == "Skip" ]] && 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
| import Image from 'next/image' | |
| import HeroImage from '/public/hero.jpg' | |
| export default function Hero() { | |
| return ( | |
| <div style={{ position: 'relative', width: '100%', height: '100vh' }}> | |
| <Image | |
| src={HeroImage} | |
| alt="Picture of the author" |
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
| { | |
| "name": "bubble", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "bubbleSort.js", | |
| "scripts": { | |
| "test": "jest" | |
| }, | |
| "author": "", | |
| "license": "ISC", |
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 binarySearch = (array, target) => { | |
| // min and max are indexes | |
| let min = 0 | |
| let max = array.length - 1 | |
| // while loop will run until min and max cross each other | |
| while(min <= max) { | |
| // find middle index | |
| const middle = Math.floor((min + max) / 2) | |
| const current = array[middle] | |
| // determine if we need to search left or right or end if we found it |
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
| { | |
| "name": "daily-quest", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "jest" | |
| }, | |
| "author": "", | |
| "license": "ISC", |
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
| " Enable syntax highlighting | |
| syntax on | |
| " Enable line numbers | |
| set number | |
| " Show matching brackets | |
| set showmatch | |
| " Indenting Configs | |
| set autoindent | |
| set smartindent | |
| set tabstop=4 |
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 System.Random (StdGen, randomR, split, newStdGen) | |
| -- main to help debug your Functor, Applicative and Monad instances | |
| -- feel free to edit main! | |
| main :: IO () | |
| main = do | |
| treeOne <- generateRandomTree 10 -- tree of ten random nodes | |
| -- you will end of needing to construct a tree of expressions of some type (a -> a) for the applicative | |
| -- you can construct that tree manually via value constructors or by creating a new generateTree function | |
| print treeOne |
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 System.Random | |
| main :: IO () | |
| main = do | |
| g1 <- newStdGen | |
| g2 <- newStdGen | |
| let tenRandomLetters = take 10 (randomRs ('a', 'z') g1) | |
| let randomInts = take 10 (randomRs (1, 10) g2) | |
| let mixLettersAndNumbers = [(letter, number) | letter <- randomLetters, number randomInts] | |
| print mix |
NewerOlder