This file contains 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
// old | |
const handleSubmit = async (event) => { | |
event.preventDefault() | |
setIsLoading(true) | |
var userMessage:ChatMessageFormat = { | |
...message, | |
id: crypto.randomUUID() | |
} | |
var searchResult = await Promise.all([runSearches(message.content, selectedCollection)]) | |
console.log("Search Result: ", searchResult) |
This file contains 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 testString = (s)=>{ | |
console.log('Evaluating string ', s) | |
let opening = ['(', '[', '{'] | |
let closing = [')', ']', '}'] | |
const findIndex = (list, char) =>{ | |
for (let i in list) |
This file contains 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 { useNavigate } from "react-router"; | |
import { fetchToken, setToken } from "./Auth"; | |
import { validateForm } from "./FormValidation"; | |
import { useState, useEffect } from "react"; | |
import axios from "axios"; | |
import Button from "react-bootstrap/Button"; | |
import { Container, Row, Col } from "react-bootstrap"; | |
import FormInput from "./components/FormInput"; | |
export default function Login() { |
This file contains 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 validateForm = (formFields, formState) => { | |
let errors = []; | |
let allowedToProceed = true; | |
//All required fields are empty | |
if (!formState) { | |
for (let field of formFields) { | |
errors.push(field); | |
} | |
setFormErrors(errors); |
This file contains 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 json | |
from bson.objectid import ObjectId | |
from pymongo.cursor import Cursor as pymongo_cursor | |
from pymongo.collection import Collection as pymongo_collection | |
from pydantic.main import ModelMetaclass | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, o): | |
if isinstance(o, ObjectId): | |
return str(o) |
This file contains 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 math | |
from PIL import Image, ImageChops | |
class AdjustImages: | |
@staticmethod | |
def get_next_height(height): | |
fullhd_height = 1080 | |
if height % fullhd_height == 0: |
This file contains 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
#!/bin/bash | |
printf "[BACKUP PROJECTS]\n\n" | |
temp_dir=$(mktemp -d) | |
package_name=backup_package | |
mkdir ~/$package_name | |
printf "COPYING TO TEMP DIR...\n\n" |
This file contains 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
local inspect = require('inspect') | |
local table = { a='a', b='b', c='c'} | |
print(inspect(table)) |
This file contains 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
find . -name "*.[extension]" | xargs wc -l | tail -1 |
This file contains 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 handleResumeForm = (inputTargetId)=>{ | |
const RESUME_INPUT = document.getElementById(inputTargetId); | |
const RESUME_FILE_NAME = RESUME_INPUT.value; | |
const ALLOWED_EXTENSIONS = ['pdf','doc','docx']; | |
const ERROR_CLASS = 'form-error'; | |
const inArray = (array, key)=>{ | |
let result = false; | |
array.forEach((item)=>{ item === key ? result = true : '' }) | |
return result; |
NewerOlder