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 { NextApiRequest, NextApiResponse } from 'next'; | |
const handler = (_req: NextApiRequest, res: NextApiResponse) => { | |
/* SUCCESS */ | |
// const body = { | |
// "id": "chatcmpl-123", | |
// "object": "chat.completion", | |
// "created": 1677652288, | |
// "model": "gpt-3.5-turbo-0613", |
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
/* | |
* More query methods: https://callstack.github.io/react-native-testing-library/docs/api-queries | |
* ReactTestInstance, returned by query methods: https://reactjs.org/docs/test-renderer.html#testinstance | |
* Jest expect methods: https://jestjs.io/docs/expect | |
*/ | |
import React from 'react'; | |
import { View } from 'react-native'; | |
import { render, cleanup } from '@testing-library/react-native/pure'; |
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 initialWagon = { | |
supplies: 100, | |
distance: 0, | |
days: 0 | |
}; | |
const reducer = (wagon = initialWagon, action) => { | |
switch (action.type) { | |
case 'travel': { | |
const days = action.payload || 1; |
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 React from "react"; | |
import "./App.css"; | |
import AllThings from "../features/allThings/AllThings"; | |
import MyThings from "../features/myThings/MyThings"; | |
import Search from "../features/search/Search"; | |
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
import React, { useEffect } from "react"; | |
import "./App.css"; | |
import { useDispatch, useSelector } from "react-redux"; | |
import { | |
loadThings, | |
selectFilteredAllThings, | |
} from "../features/allThings/allThingsSlice"; | |
import AllThings from "../features/allThings/AllThings"; | |
import { | |
addThing, |
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
main { | |
position: relative; | |
} | |
div#flex-container { | |
display: flex; | |
justify-content: center; | |
} | |
div.position-relative { |
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
// Save code file as a string | |
var code = Components.CodeEditor.readFileContent('Startup.cs'); | |
// Match a regex pattern and capture a value from learner code | |
var codeMatches = code.match(/Configure\s*\(.*\)\s*\{\s*([\s\S]*)app\.UseHttpsRedirection/); | |
if (!codeMatches) { | |
return { | |
pass: false, | |
errors: { |
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
// Add a janky form of Intellisense for P5.js | |
/// <reference path="./libraries/p5.d/p5.global-mode.d.ts" /> | |
var imageWidth = 640; | |
var imageHeight = 480; | |
var canvasWidth = imageWidth * 2; | |
var canvasHeight = imageHeight; | |
var sourceImage; | |
var captureVideo; | |
var prevFrame; |
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 express = require('express'); | |
const app = express(); | |
const port = 3000; | |
const zoo = [ | |
'zebra', | |
'gecko', | |
'elephant', | |
'dog', | |
'parrot' |
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
<form method="post"> | |
<div class="form-group row"> | |
<label class="col-6" for="fruits">How many servings of fruits did you have today?</label> | |
<div class="col-2"> | |
<!-- how do I use asp-for here? --> | |
<select class="form-control" id="fruits" name="fruits"> | |
<option>1</option> | |
<option>2</option> | |
<option>3</option> | |
<option>4</option> |
NewerOlder