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
| /** | |
| * * @param {express.Request} req | |
| * * @param {express.Response} res | |
| */ | |
| function getOrigin(origin, callback) { | |
| try { | |
| const _allowedOrigins = process.env.MODE ? [ | |
| "http://localhost:3000", //for local development | |
| "http://localhost:3001" |
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 { initializeApp } from "firebase/app"; | |
| import e from "express"; | |
| import {getDocs, getDoc, doc, setDoc, collection, getFirestore, query, where} from "firebase/firestore"; | |
| // TODO: Add SDKs for Firebase products that you want to use | |
| // https://firebase.google.com/docs/web/setup#available-libraries | |
| // Your web app's Firebase configuration | |
| // For Firebase JS SDK v7.20.0 and later, measurementId is optional | |
| const firebaseConfig = { |
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
| # prompt: basic flask app | |
| import os | |
| from threading import Thread | |
| from flask import Flask | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def hello_world(): | |
| return 'Hello, World!' |
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 socketio | |
| sio = socketio.Client(reconnection=True) | |
| @sio.event | |
| def connect(): | |
| print("Connected to the server") | |
| sio.send("Hello world!") | |
| @sio.event | |
| def message(data): | |
| print(f"Received message: {data}") | |
| @sio.event |
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
| <meta name="viewport" content="width=device-width,initial-scale=1.0"/> | |
| <body id="body"> | |
| <div id="con"> | |
| <div id="red"></div> | |
| <div id="blue"></div> | |
| <div id="yellow"></div></div> | |
| <style> | |
| #body{ | |
| position: relative; | |
| background-color: #000; |
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 discord, re, pytz, time | |
| from discord.ext import commands, tasks | |
| #from datetime import datetime | |
| intents = discord.Intents.default() | |
| intents.members = True | |
| intents.presences = True | |
| intents.message_content = True | |
| bot = commands.AutoShardedBot(shard_count=1,command_prefix='.',intents=intents) |
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
| def time_format(delta): #0:40:45.3456456 | |
| delta = str(delta) | |
| time = "" | |
| lst = delt.split(".")[0].split(":") | |
| if(len(lst)<=3): | |
| h,m,s = delt.split(".")[0].split(":") | |
| time = f"{h}hr, {m}min, {s}sec" | |
| elif(len(lst)>3): | |
| d,h,m,s = delt.split(".")[0].split(":") | |
| time = f"{d}day, {h}hr, {m}min, {s}sec" |
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
| def sum(a, b, c ): | |
| return a + b + c | |
| def printBoard(xState, zState): | |
| zero = 'X' if xState[0] else ('O' if zState[0] else 0) | |
| one = 'X' if xState[1] else ('O' if zState[1] else 1) | |
| two = 'X' if xState[2] else ('O' if zState[2] else 2) | |
| three = 'X' if xState[3] else ('O' if zState[3] else 3) | |
| four = 'X' if xState[4] else ('O' if zState[4] else 4) | |
| five = 'X' if xState[5] else ('O' if zState[5] else 5) |
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 id="esportsForm"> | |
| <!-- <label for="org">Organization:</label> --> | |
| <input type="text" id="org" placeholder="Org Name" name="org"> | |
| <br> | |
| <br> | |
| <!-- <label for="tname">Tournament Name:</label> --> | |
| <input type="text" id="tname" placeholder="Tournament Name" name="tname"> | |
| <table> | |
| <thead> |
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
| <!-- templates/index.html --> | |
| <html> | |
| <body> | |
| <h1>Real-Time Website</h1> | |
| <div id="data-container"></div> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.3/socket.io.js"></script> | |
| <script> | |
| const socket = io.connect('http://' + document.domain + ':' + location.port); |
NewerOlder