npm init -y
Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.
import "./App.css"; | |
import { useEffect, useState } from "react"; | |
import { useCompletion } from "ai/react"; | |
function App() { | |
const [apiResponse, setApiResponse] = useState(""); | |
useEffect(() => { | |
fetch("/api/reply?value=Hello from React App!") | |
.then((response) => response.json()) |
# The goal of this file is to provide a FastAPI application for handling | |
# chat requests amd generation AI-powered responses using conversation chains. | |
# The application uses the LangChaing library, which includes a chatOpenAI model | |
# for natural language processing. | |
# The `StreamingConversationChain` class is responsible for creating and storing | |
# conversation memories and generating responses. It utilizes the `ChatOpenAI` model | |
# and a callback handler to stream responses as they're generated. | |
# The application defines a `ChatRequest` model for handling chat requests, |
const main = async () => { | |
const context = new AudioContext(); | |
const microphone = await navigator.mediaDevices | |
.getUserMedia({ | |
audio: true | |
}) | |
const source = context.createMediaStreamSource(microphone); |
/** | |
* Define an array to be a Martian array if the number of 1s is greater than the number of 2s and no two adjacent elements are equal. | |
* | |
* Write a function named isMartian that returns 1 if its argument is a Martian array; otherwise it returns 0. | |
* | |
* If you are programming in Java or C#, the function signature is | |
* int isMartian(int[ ] a) | |
* | |
* There are two additional requirements. | |
* |
import express from "express"; | |
import data from "../data"; | |
import bodyParser from "body-parser"; | |
const postRouter = express.Router(); | |
postRouter.use(bodyParser.json()); // to use body object in requests | |
postRouter.get("/", (req, res) => { | |
res.send(data); | |
}); |
-- Sets your audio input source to "Internal Microphone" | |
-- Frequently needed if you use bluetooth headpohones and | |
-- run the Xcode iOS simulator, which will often set your | |
-- headphones to be the input device, resulting in a drastic | |
-- decrease in sound quality, and making it mono | |
tell application "System Preferences" to activate | |
tell application "System Preferences" | |
reveal anchor "input" of pane id "com.apple.preference.sound" | |
end tell |
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |
/* | |
Evaluation Of postfix Expression in C++ | |
Input Postfix expression must be in a desired format. | |
Operands must be integers and there should be space in between two operands. | |
Only '+' , '-' , '*' and '/' operators are expected. | |
*/ | |
#include<iostream> | |
#include<stack> | |
#include<string> |
/** | |
* Shunting yard algorithm | |
* See: http://en.wikipedia.org/wiki/Shunting_yard_algorithm | |
* | |
* Converts infix notation to postfix notation | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* MIT Style License | |
* | |
* (C) 2011, updated on 2020 |