This file contains 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
interface Listener<T> { | |
boolean isActive(); // active, default true | |
void remove(); // active = false | |
void fire(T event); | |
} | |
private final AtomicInteger next = new AtomicInteger(0); | |
private final AtomicInteger listenerCount = new AtomicInteger(0); | |
private final AtomicInteger removed = new AtomicInteger(0); |
This file contains 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 Fastify = require('fastify'); | |
const fastify = new Fastify(); | |
const fs = require('fs'); | |
const path = require('path'); | |
const uploads = path.resolve(process.env.UPLOAD_DIR); | |
fs.mkdirSync(uploads, { recursive: true }); |
This file contains 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 { RichEmbed, MessageEmbed } = require('discord.js'); | |
const Embed = RichEmbed || MessageEmbed; | |
const commands = { | |
'title': (embed, input) => embed.setTitle(input), | |
'description' (embed, input) => embed.setDescription(input), | |
// etc | |
} |
This file contains 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 interface Particles { | |
static Particles LT9 = new ParticlesLT9(); | |
static Particles GE9 = new ParticlesGE9(); | |
void summonParticles(Player p, String particles); | |
private static Particles getParticles() { | |
return getVersionNumber() < 9 ? LE9 : GE9; | |
} |
This file contains 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 interface FieldResolver extends BiFunction<SelectionSet, Map<String, Object>, CompletableFuture<?>> { | |
} |
This file contains 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 Query { | |
private User.Query user; | |
private Query(Builder builder) { | |
user = builder.user; | |
} | |
public static Builder builder() { | |
return new Builder(); | |
} |
This file contains 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 java.util.Deque; | |
import java.util.Objects; | |
import java.util.Queue; | |
import java.util.Set; | |
import java.util.HashSet; | |
import java.util.LinkedList; | |
import java.util.Map; | |
import java.util.HashMap; | |
class MarkdownFormatter { |
This file contains 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 { Constants: { APIErrors }} = require('discord.js'); | |
const errorCodes = new Set(Object.values(APIErrors)); | |
/** | |
* Usage: | |
* const {APIErrors: {CANNOT_MESSAGE_USER}, ignore} = require('./ignore-errors.js'); | |
* try { | |
* let message = await user.send('Hello world').catch(ignore(CANNOT_MESSAGE_USER)); | |
* if (message === null) { | |
* // User has DMs closed |
This file contains 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 fs = require('fs'); | |
const path = require('path'); | |
function getStat(path) { | |
try { | |
return fs.statSync(path); | |
} catch (e) { | |
return null; | |
} | |
} |
This file contains 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
Received: from HK2APC01HT106.eop-APC01.prod.protection.outlook.com (2603:10a6:209:7f::27) by AM6PR08MB4246.eurprd08.prod.outlook.com with HTTPS via AM6P191CA0050.EURP191.PROD.OUTLOOK.COM; Mon, 4 Feb 2019 05:21:53 +0000 | |
Received: from HK2APC01FT025.eop-APC01.prod.protection.outlook.com (10.152.248.53) by HK2APC01HT106.eop-APC01.prod.protection.outlook.com (10.152.249.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10; Mon, 4 Feb 2019 05:21:52 +0000 | |
Authentication-Results: spf=none (sender IP is 5.157.86.28) smtp.mailfrom=administratie.nl; live.nl; dkim=pass (signature was verified) header.d=pbandenvervanger.nl;live.nl; dmarc=none action=none header.from=administratie.nl; | |
Received-SPF: None (protection.outlook.com: administratie.nl does not designate permitted sender hosts) | |
Received: from filter03.hostcontrol.com (5.157.86.28) by HK2APC01FT025.mail.protection.outlook.com (10.152.248.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_ |
NewerOlder