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
| from flask import Flask, jsonify | |
| from flask_cors import CORS, cross_origin | |
| app = Flask(__name__) | |
| CORS(app) | |
| @app.route('/api', methods=['GET']) | |
| def greet(): | |
| return jsonify({'message': 'Hello python'}) |
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 formatTextLink = (text: string, link?: string) => { | |
| const split1 = text.split("["); | |
| const beforeLink = split1[0]; | |
| const split2 = split1[1].split("]"); | |
| const linkText = split2[0]; | |
| const afterLink = split2[1]; | |
| return ( | |
| <> | |
| {beforeLink} |
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 uuidv4 = () => | |
| "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (x) => { | |
| const random = (Math.random() * 16) | 0; | |
| const value = x === "x" ? random : (random & 0x3) | 0x8; | |
| return value.toString(16); | |
| }); |
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 copyToClipboard = (value) => { | |
| const body = document.body; | |
| const storage = document.createElement("textarea"); | |
| storage.value = value; | |
| body.appendChild(storage); | |
| storage.select(); | |
| storage.setSelectionRange(0, 99999); | |
| document.execCommand("copy"); | |
| body.removeChild(storage); |
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
| // Create an initial function file | |
| // Add.ts | |
| const Add = (x: number, y: number) => { | |
| return x + y; | |
| }; | |
| export default Add; |
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 styled from "styled-components"; | |
| import moment from "moment"; | |
| import { useState } from "react"; | |
| const firstDayOfMonth = (date: any) => | |
| moment(date).startOf("month").format("d"); | |
| const getBlanks = (firstDayOfMonth: number) => { | |
| const blanks = []; | |
| for (let i = 0; i < firstDayOfMonth; i++) { |
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 byName = (a, b) => { | |
| if (a.name > b.name) return 1; | |
| if (a.name < b.name) return -1; | |
| return 0; | |
| }; |
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 handleChangePosition = ( | |
| oldIndex, | |
| newIndex, | |
| array | |
| ) => { | |
| if (newIndex < 0 || newIndex > array.length - 1) return []; | |
| const newArray = [...array]; | |
| const oldObj = array[oldIndex]; | |
| const newObj = array[newIndex]; |
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 createFile = (data, filename, type) => { | |
| const file = new Blob([data], { type: type }); | |
| var a = document.createElement("a"), | |
| url = URL.createObjectURL(file); | |
| a.href = url; | |
| a.download = filename; | |
| a.style.color = "white"; | |
| const exportEl = document.getElementById("export"); | |
| if (exportEl) { | |
| exportEl.style.marginTop = "15px"; |
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
| export const getSaved = () => | |
| JSON.parse(localStorage.getItem("new-tag") || "{}"); | |
| export const save = (value) => | |
| localStorage.setItem("new-tag", JSON.stringify(value)); |
NewerOlder