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 onnxruntime as ort | |
| import numpy as np | |
| import cv2 | |
| import os | |
| import time | |
| from datetime import datetime | |
| import requests | |
| import json | |
| # === Configuration === |
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
| // utils.js | |
| export async function getUserData() { | |
| const res = await fetch('https://jsonplaceholder.typicode.com/users/1') | |
| return res.json() | |
| } | |
| // UserComponent.jsx | |
| import { use } from 'react' | |
| import { getUserData } from './utils' |
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
| // redux/api.js | |
| import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' | |
| export const api = createApi({ | |
| reducerPath: 'api', | |
| baseQuery: fetchBaseQuery({ baseUrl: '/api' }), | |
| tagTypes: ['Post'], | |
| endpoints: (builder) => ({ | |
| getPosts: builder.query({ | |
| query: () => 'posts', |
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: CI for Node Apps | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: |
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 in you package json build script like this - | |
| "build": "vite build && node bundle.js", | |
| */ | |
| import fs from "fs"; | |
| import archiver from "archiver"; | |
| import { DateTime } from "luxon"; | |
| var output = fs.createWriteStream("dist.zip"); | |
| var archive = archiver("zip"); |
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, { useState } from "react"; | |
| import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; | |
| const listArray = { | |
| Earth: [ | |
| { | |
| label: "Iron Man", | |
| id: 1001, | |
| }, | |
| { |
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": "react-learning", | |
| "version": "0.1.0", | |
| "private": true, | |
| "dependencies": { | |
| "axios": "^0.27.2", | |
| "react": "^18.2.0", | |
| "react-dom": "^18.2.0", | |
| "react-router-dom": "^6.3.0", | |
| "react-scripts": "5.0.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 axios from "axios"; | |
| class RegisterForm extends React.Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| name: "", | |
| age: 0, | |
| password: "", |
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
| /** | |
| * Handling Forms and different events | |
| * Conditional rendering | |
| * Looping in react | |
| */ | |
| // import "./style.css"; | |
| import { useState, createRef } from "react"; | |
| const RenderResult = (props) => { | |
| const { showResult, firstName, removeHandler } = props; | |
| const arrayOfCharacters = firstName.split(""); |
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 { useState } from "react"; | |
| import { Link } from "react-router-dom"; | |
| const dogsListAPI = "https://dog.ceo/api/breeds/list/all"; | |
| const DogsComponent = () => { | |
| const [breeds, setBreeds] = useState([]); | |
| const [image, setImage] = useState(); | |
| const [currentBreed, setCurrentBreed] = useState(""); | |
| const getBreedsList = () => { |
NewerOlder