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 { ChatPromptTemplate } from '@langchain/core/prompts' | |
import { AzureChatOpenAI } from '@langchain/openai' | |
import { z } from 'zod' | |
import { zodToJsonSchema } from 'zod-to-json-schema' | |
const azureOpenAi4o = new AzureChatOpenAI({ | |
model: 'gpt-4o', | |
temperature: 0, | |
maxRetries: 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
-- Create the table | |
create table survey_responses ( | |
customer_id varchar(30), | |
timely_responses int, | |
timely_fixes int, | |
timely_replacement int, | |
reliability int, | |
"options" int, | |
respectful int, | |
courteous int, |
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
// useMeasureElementWidth.js | |
import { useEffect, useState } from 'react' | |
export default function useMeasureElementWidth() { | |
const [width, setWidth] = useState() | |
useEffect(() => { | |
setWidth(document.body.offsetWidth) | |
}, []) |
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
// app.js | |
import React from 'react' | |
import { Router, Route } from 'react-router-dom' | |
import { createHashHistory } from 'history' | |
// How would you "mock" this in a way that could be changed on a test-basis? | |
const history = createHashHistory() | |
export default function App() { | |
return ( |
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
// constants.js | |
export const IS_FIREFOX = true | |
// fixAspectRatio.js | |
import { IS_FIREFOX } from './constants' | |
export default function fixAspectRatio(img) { | |
if (IS_FIREFOX) { | |
img.width = 10 | |
} |
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
let totalResult = [] | |
function getInfo(element, depth){ | |
const id = getIdentifier(element) | |
const styles = getStyles(element) | |
const listeners = getListeners(element) | |
const result = { | |
id, styles, listeners, depth | |
} |
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
export default function (babel) { | |
const { types: t } = babel; | |
return { | |
name: "ast-transform", // not required | |
visitor: { | |
JSXElement(path) { | |
const { openingElement } = path.node | |
const name = getReactComponentName(path.node); | |
if (name === "Route" || name === "PageRoute") { |
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
class Person { | |
constructor(...traits) { traits.forEach(trait => this[trait] = true) } | |
} | |
const storyBegins = "7/18/17" | |
const laura = new Person("smart", "kind", "caring") | |
const clint = new Person("hard working", "attentive", "fast") | |
const activities = ["frisbee", "institute"] |
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 { useRef } from 'react' | |
const useIsInitialValue = watchedValue => { | |
const initialValue = useRef(watchedValue) | |
const cache = useRef(null) | |
if (cache.current != null) { | |
return cache.current | |
} |