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 requests | |
| import time | |
| import os | |
| import json | |
| from typing import List, Dict, Any | |
| from dotenv import load_dotenv | |
| class ApiConfig: | |
| BASE_URL = "https://studio-api.prod.suno.com" | |
| GENERATE_ENDPOINT = "/api/generate/v2-web/" |
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 memorizeFn = <T extends () => void>(fn: T, size = 5, duration = 0): any => { | |
| const cache: Map<string, any> = new Map<string, any>(); | |
| if (duration) { | |
| setInterval(() => cache.clear(), duration); | |
| } | |
| return (...args: any[]): any => { | |
| const key: string = JSON.stringify(args); | |
| if (!cache.has(key)) { | |
| cache.set(key, (fn as any)(...args)); |
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 { Inject, Injectable, NgZone } from '@angular/core'; | |
| import { EVENT_MANAGER_PLUGINS, EventManager } from '@angular/platform-browser'; | |
| export const RUN_OUTSIDE: string = '.run-outside'; | |
| /** | |
| * @example | |
| * | |
| * @NgModule({ | |
| * // ... |
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
| /** | |
| * A point representing a location in (x,y) coordinate space, specified in integer precision. | |
| */ | |
| export class Point { | |
| /** | |
| * The X coordinate of this Point. | |
| * @default 0 | |
| */ | |
| protected x: number; |
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
| /** | |
| * The Dimension class encapsulates the width and height | |
| * of a component (in integer precision) in a single object. | |
| */ | |
| export class Dimension { | |
| /** | |
| * The width dimension; negative values can be used. | |
| * @default 0 | |
| */ | |
| protected width: number; |
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
| /** | |
| * https://en.wikipedia.org/wiki/Centroid#Of_a_polygon | |
| */ | |
| public getPolygonCentroid(vertices: number[][]): { lat: number, lon: number } { | |
| const centroid: { lat: number, lon: number } = { lat: 0, lon: 0 }; | |
| const vertexCount: number = vertices.length; | |
| let area: number = 0; | |
| let x0: number = 0; // Current vertex X | |
| let y0: number = 0; // Current vertex Y |