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
| // Please do not comment or give the answer to anybody, let people try to solve it | |
| function makeRequest(endpoint, before) { | |
| return new Promisse((res, rej) => { | |
| before("Making request to " + endpoint); | |
| fetch(endpoint).then(a => res(a)).catch(a => rej(a)); | |
| }); | |
| } |
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 COMPLETE_CHAR = "█"; | |
| const INCOMPLETE_CHAR = "░"; | |
| class ProgressBar { | |
| constructor(public total = 15) {} | |
| setTotal(total: number) { | |
| this.total = total; | |
| } |
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
| // Constantes | |
| int nums[17][7] = { | |
| {1, 1, 1, 1, 1, 1, 1}, | |
| {0, 0, 0, 0, 0, 0, 1}, | |
| {0, 1, 0, 1, 1, 1, 1}, | |
| {0, 0, 1, 0, 0, 1, 0}, | |
| {0, 0, 0, 0, 1, 1, 0}, | |
| {0, 1, 0, 1, 1, 0, 0}, | |
| {1, 0, 0, 0, 1, 0, 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
| { | |
| "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", | |
| "meta": { | |
| "version": "PTDL_v1" | |
| }, | |
| "exported_at": "2020-11-30T19:48:12+01:00", | |
| "name": "NodeJs v12", | |
| "author": "spam@arantes.dev", | |
| "description": "NodeJS v12 egg based on https://github.com/parkervcp/eggs/blob/master/bots/discord/discord.js/egg-discord-js-generic.json", | |
| "features": null, |
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
| public class RandomCollection<E> { | |
| private final NavigableMap<Double, E> map = new TreeMap<>(); | |
| private final Random random; | |
| private double total = 0; | |
| public RandomCollection() { | |
| this(new Random()); | |
| } |
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
| class MyListener implements Listener { | |
| // Nome do atributo que será salvo no NBT | |
| private static String ATTRIBUTE_NAME = "pick_xp"; | |
| @EventHandler | |
| public void onBreak(BlockBreakEvent event) { | |
| // Pega o jogador e o item na mão | |
| Player player = event.getPlayer(); | |
| ItemStack item = player.getInventory().getItemInMainHand(); |
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
| package dev.arantes.acore.modules.essentials; | |
| import dev.arantes.acore.exceptions.NoPermissionException; | |
| import dev.arantes.acore.exceptions.NotEnoughArgumentsException; | |
| import dev.arantes.acore.exceptions.PlayerNotOnlineException; | |
| import dev.arantes.acore.modules.globaluser.GlobalUser; | |
| import dev.arantes.acore.templates.Command; | |
| import dev.arantes.lib.exceptions.CustomMessageException; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.GameMode; |
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 sql = require("sqlite"); | |
| async function create(data) { | |
| if (!data) throw new Error("No data!"); | |
| return await sql.run( | |
| "INSERT INTO Veicle (id, type, model) VALUES ($id, $type, $model)", | |
| data, | |
| ); | |
| } |
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 { MongoClient } from "mongodb" | |
| const run = async () => { | |
| const uri = "mongodb+srv://user:pass@sample.host/?poolSize=20&writeConcern=majority" | |
| const client = await MongoClient.connect(uri, { | |
| useNewUrlParser: true, | |
| useUnifiedTopology: true | |
| }) | |
| const db = client.db("MeuAppTop") |
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 isEmpty, { IsEmptyOptions } from 'validator/lib/isEmpty' | |
| const checkEmpty = ( | |
| error: (message: string) => unknown, | |
| options?: IsEmptyOptions | |
| ) => (value: string, fieldName: string): void => { | |
| if (isEmpty(value, options)) { | |
| throw error(`Field ${fieldName} cannot be empty!`) | |
| } | |
| } |