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
from dotenv import load_dotenv | |
from flask import Flask | |
from flask import render_template | |
from flask import request | |
from flask import url_for | |
import json | |
import os | |
import pandas as pd | |
import pinecone | |
import re |
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
from dotenv import load_dotenv | |
from flask import Flask | |
from flask import render_template | |
from flask import request | |
from flask import url_for | |
import json | |
import os | |
import pandas as pd | |
import pinecone | |
import requests |
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
type Inputs = { | |
playerID: string; | |
}; | |
type Match = { | |
matchID: string; | |
winnerID: string; | |
loserID: string; | |
}; |
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
type PlayerRecord = { | |
playerID: string; | |
losses: number; | |
wins: number; | |
}; | |
type PlayerRecords = { | |
[key: string]: PlayerRecord; | |
}; |
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
type Inputs = { | |
playerOneID: string; | |
playerTwoID: string; | |
winnerID: string; | |
}; | |
export async function handler(inputs: Inputs) { | |
const { playerOneID, playerTwoID, winnerID } = inputs; | |
if (!playerOneID || !playerTwoID || !winnerID) { |
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
function downloadPDFWithPDFMake() { | |
var tableHeaderText = [...document.querySelectorAll('#styledTable thead tr th')].map(thElement => ({ text: thElement.textContent, style: 'tableHeader' })); | |
var tableRowCells = [...document.querySelectorAll('#styledTable tbody tr td')].map(tdElement => ({ text: tdElement.textContent, style: 'tableData' })); | |
var tableDataAsRows = tableRowCells.reduce((rows, cellData, index) => { | |
if (index % 4 === 0) { | |
rows.push([]); | |
} | |
rows[rows.length - 1].push(cellData); |
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
export const findKeyInBox = (box) => { | |
console.log(`Looking in Box ${box.id}`); | |
for (let i = 0; i < box.contents.length; i++) { | |
if (box.contents[i].type === 'key') { | |
console.log(`Found the key in Box ${box.id}!`); | |
return box.id; | |
} | |
if (box.contents[i].type === 'box') { |
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
export const findKeyInBox = (box) => { | |
const pile = []; | |
pile.push(box); | |
while (pile.length > 0) { | |
const currentBox = pile.pop(); | |
console.log(`Looking in Box ${currentBox.id}`); | |
for (let i = 0; i < currentBox.contents.length; i++) { | |
if (currentBox.contents[i].type === 'key') { |
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
export const maxNumberArray = (numbers) => { | |
if (numbers.length <= 1) { | |
return numbers[0]; | |
} | |
const numberA = numbers[0]; | |
const numberB = maxNumberArray(numbers.slice(1)); | |
return numberA > numberB ? numberA : numberB; | |
}; |
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
export const maxNumberArray = (numbers) => { | |
let max = numbers[0]; | |
for (let i = 1; i < numbers.length; i++) { | |
if (numbers[i] > max) { | |
max = numbers[i]; | |
} | |
} | |
return max; |
NewerOlder