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 { Collection } from "../../deps.ts"; | |
| import { BaseRestApiUrl } from "../constants/mod.ts"; | |
| import { HttpError } from "../handler/errors/http.ts"; | |
| export class RestClient extends Collection<string, Record<any, any>> { | |
| constructor() { | |
| super(); | |
| } | |
| async request( | |
| href: string, |
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
| // async createSticker({ | |
| // description, filePath, name, tags, fileName | |
| // }: { | |
| // /** | |
| // * The Name of the Sticker | |
| // */ | |
| // name: string, | |
| // /** | |
| // * The Description of the Sticker | |
| // */ |
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
| with open("school.txt") as f: | |
| data = f.read() | |
| lines = data.split("\n") | |
| total_words = len(data.replace("\n","")) | |
| total_lines = len(lines) | |
| vowels = 0 | |
| consonants = 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
| /// Get Balance of your account or another user | |
| #[poise::command(slash_command, prefix_command)] | |
| pub async fn balance( | |
| ctx: Context<'_>, | |
| #[description = "Selected user"] user: Option<User>, | |
| ) -> Result<(), Error> { | |
| let u = user.as_ref().unwrap_or_else(|| ctx.author()); | |
| ctx.defer().await.expect("Cannot defer"); | |
| let client = ctx.data(); | |
| let id = u.id.0.clone().to_string(); |
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 bottomBarActions = useMemo(() => { | |
| const actions = [ | |
| { | |
| name: "Home", | |
| icon: ( | |
| <Entypo | |
| name="home" | |
| size={24} | |
| color={theme === "Dark" ? "#fff" : "#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 jose from 'node-jose'; | |
| const urlToGetLinkedInAccessToken = | |
| 'https://www.linkedin.com/oauth/v2/accessToken'; | |
| export type LinkedInUser = { | |
| iss: string; | |
| aud: string; | |
| iat: number; | |
| exp: 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
| String getErrorMessage(dynamic error, [String? message]) { | |
| if (error is String) { | |
| return error; | |
| } else if (error is Map) { | |
| if (error['message'] is List) { | |
| return error['message'][0]; | |
| } else { | |
| return error['message']; | |
| } | |
| } else { |
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 {randomBytes} from "crypto" | |
| async createChat(userId: string, body: CreateChatDTO) { | |
| const key = randomBytes(32).toString('base64'); | |
| const iv = randomBytes(16).toString('base64'); | |
| const chat = await prisma.chat.create({ | |
| data: { | |
| id: `ch_${createId()}`, | |
| name: body.name, | |
| topic: body.topic, |
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 Nestjs filter which "filters" out all exceptions to add custom logging logic | |
| import { Request, Response } from 'express'; | |
| import { IncomingMessage } from 'http'; | |
| import { | |
| ArgumentsHost, | |
| BadRequestException, | |
| Catch, | |
| ExceptionFilter, | |
| HttpException, |
OlderNewer