Skip to content

Instantly share code, notes, and snippets.

View WesJD's full-sized avatar

Wesley Smith WesJD

View GitHub Profile
public enum BooleanFieldEnum {
// 2000 enum constants
private final boolean set;
BooleanFieldEnum() {
// Compute value on class loading, doesn't affect benchmark results
this.set = ThreadLocalRandom.current().nextBoolean();
}
@hugmanrique
hugmanrique / findMinimum.js
Last active July 24, 2021 22:05
Multivariate (ℝ^2) relative minimum brute-force finder
// The function we want to find the minimums of
// https://i.imgur.com/GG6uXvD.png
const getValue = (m, n) => m * m + n * n;
// The sampling interval (in ℝ^2)
let mStart = 0;
let nStart = 0;
let mEnd = 1;
let nEnd = 1;
@SilverCory
SilverCory / LocationAdapter.java
Created July 4, 2016 02:05
A location type adapter for Gson.
import com.google.gson.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import java.lang.reflect.Type;
/**
* A gson adapter for {@link org.bukkit.Location}.
* <p>
@exception
exception / instructions.md
Created January 24, 2016 16:27
Ubuntu screnshoting for Pxl.lt

#Instructions After creating the screenshot.sh file you shoud:

  • Assign a Key to the screenshot.sh file
@DarkSeraphim
DarkSeraphim / SkinChanger.java
Last active May 5, 2020 18:37
Notchifier - Thou shall be Notch
package net.darkseraphim.test;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.PlayerInfoData;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
@aadnk
aadnk / BukkitSerialization.java
Created December 26, 2013 20:17
Serialize and deserialize inventories to a string.
package com.comphenix.example;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.io.BukkitObjectInputStream;
@FredrikWendt
FredrikWendt / JedisTest.java
Created August 13, 2012 20:23
Example usage of Jedis
package se.wendt.statoil.mastercard;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;
public class JedisTest {