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 final class HTTPUtil { | |
private static Map<String, String> properties = new HashMap<>(); | |
public static void withRequestProperty(String key, String value) { | |
properties.put(key, value); | |
} | |
public static void removeProperty(String key) { | |
properties.remove(key); |
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 is_whitespace = (value) => /\s/.test(value) | |
const is_alpha = (value) => (value => | |
(value > 64 && value < 91) || (value > 96 && value < 123) || (value == 95)) (value.charCodeAt()) | |
const is_numeric = (value) => (value => | |
(value > 47 && value < 58)) (value.charCodeAt()) | |
const is_alphanumeric = (value) => (value => | |
(value > 47 && value < 58) || (value > 64 && value < 91) || (value > 96 && value < 123) || (value == 95)) (value.charCodeAt()) |
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 com.mojang.authlib.GameProfile; | |
import com.mojang.authlib.properties.Property; | |
import com.mojang.datafixers.util.Pair; | |
import io.netty.buffer.Unpooled; | |
import net.minecraft.core.BlockPosition; | |
import net.minecraft.nbt.NBTTagCompound; | |
import net.minecraft.network.PacketDataSerializer; | |
import net.minecraft.network.chat.IChatBaseComponent; | |
import net.minecraft.network.protocol.Packet; | |
import net.minecraft.network.protocol.game.*; |
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 com.google.gson.*; | |
import org.bukkit.Color; | |
import org.bukkit.DyeColor; | |
import org.bukkit.FireworkEffect; | |
import org.bukkit.Material; | |
import org.bukkit.block.banner.Pattern; | |
import org.bukkit.block.banner.PatternType; | |
import org.bukkit.enchantments.Enchantment; | |
import org.bukkit.inventory.ItemFlag; | |
import org.bukkit.inventory.ItemStack; |
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 final class Cache<T> extends ArrayList<T> { | |
protected T find(Predicate<T> predicate) { | |
for(T value : this) | |
if(predicate.test(value)) | |
return value; | |
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
Experienced: JavaScript, TypeScript | |
Intermediate: C, C++, Java, V | |
Beginner: Go, Rust, Assembly (intending to learn) |
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
*, *::before, *::after { | |
box-sizing: border-box; | |
} | |
* { | |
margin: 0; | |
} | |
html, body { | |
height: 100%; |
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
/** | |
* Converts the player inventory to a String array of Base64 strings. First string is the content and second string is the armor. | |
* | |
* @param playerInventory to turn into an array of strings. | |
* @return Array of strings: [ main content, armor content ] | |
* @throws IllegalStateException | |
*/ | |
public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException { | |
//get the main content part, this doesn't return the armor | |
String content = toBase64(playerInventory); |
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
// All valid credit card numbers | |
const valid1 = [4, 5, 3, 9, 6, 7, 7, 9, 0, 8, 0, 1, 6, 8, 0, 8]; | |
const valid2 = [5, 5, 3, 5, 7, 6, 6, 7, 6, 8, 7, 5, 1, 4, 3, 9]; | |
const valid3 = [3, 7, 1, 6, 1, 2, 0, 1, 9, 9, 8, 5, 2, 3, 6]; | |
const valid4 = [6, 0, 1, 1, 1, 4, 4, 3, 4, 0, 6, 8, 2, 9, 0, 5]; | |
const valid5 = [4, 5, 3, 9, 4, 0, 4, 9, 6, 7, 8, 6, 9, 6, 6, 6]; | |
// All invalid credit card numbers | |
const invalid1 = [4, 5, 3, 2, 7, 7, 8, 7, 7, 1, 0, 9, 1, 7, 9, 5]; | |
const invalid2 = [5, 7, 9, 5, 5, 9, 3, 3, 9, 2, 1, 3, 4, 6, 4, 3]; |
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
class Indexable { | |
constructor(){ | |
this._indexer = Symbol(); | |
} | |
[Symbol.toPrimitive](){ return this._indexer } | |
} | |
class Animal extends Indexable {} | |
const cat = new Animal(); |
NewerOlder