Skip to content

Instantly share code, notes, and snippets.

View Matthewacon's full-sized avatar
🔥
"everything is a type if you're brave enough"

Matthewacon Matthewacon

🔥
"everything is a type if you're brave enough"
View GitHub Profile
@Matthewacon
Matthewacon / PointerInequality.cpp
Created August 31, 2017 06:58
Did you just misappropriate the arguments to my clusterf*ck of unreadable specialized template functions?
#include <iostream>
//Intermediary Dummy Type
class ITest;
//Base class
template<typename T=ITest>
class Test {
public:
Test() {
//Ensure that subclasses implement these methods, if not then throws compiler error
package wurmcraft.serveressentials.common.commands.test;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import wurmcraft.serveressentials.common.api.storage.*;

Keybase proof

I hereby claim:

  • I am matthewacon on github.
  • I am matthewacon (https://keybase.io/matthewacon) on keybase.
  • I have a public key ASBWCEuhe5uOYs3cVCma9tFHNm6iT55ddtMu7jgb5XcjRAo

To claim this, I am signing this object:

@Matthewacon
Matthewacon / StaticInitializationProblems.java
Last active January 3, 2017 16:50
Exception in thread "main" java.lang.InternalError: CallerSensitive annotation expected at frame 1
import sun.reflect.Reflection;
public class StaticInitializationProblems {
static {
doSomething();
}
public static void doSomething() {
System.out.println(Reflection.getCallerClass().getSimpleName());
}
@Matthewacon
Matthewacon / Packet.h
Created July 18, 2016 14:09
Rip iteration
Byte* getRelevantData(RakBitStream& stream) {
unsigned long protocolLength = sizeOfArray(protocolInfo);
unsigned long relevantDataLength = sizeOfArray(relevantData);
//Determining the final total length of the byte array to be returned.
unsigned long finalRelevantLength;
for (unsigned long l = 0l; l < relevantDataLength; l++) {
finalRelevantLength += protocolInfo[relevantData[l]];
}
@Matthewacon
Matthewacon / console.log
Created June 18, 2016 02:15
You know you've dun gud when you get bytecode discrepancies in your code...
Exception in thread "main" java.lang.VerifyError: Bad return type
Exception Details:
Location:
ToolAccessor$1792393294.customOperator()Ljava/lang/Integer; @54: ireturn
Reason:
Type integer (current frame, stack[0]) is not assignable to 'java/lang/Integer' (from method signature)
Current Frame:
bci: @54
flags: { }
locals: { 'ToolAccessor$1792393294', integer, integer, integer }
@Matthewacon
Matthewacon / Generic Runtime Compilation Benchmarking
Created June 8, 2016 21:26
IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Total system memory: 422.0
- Free memory before benchmark: 415.3699417114258
Index: 0
- Duration: 58
- Output: [[[[[[[[Ljava.lang.Character;@69222c14
Index: 1
- Duration: 1
- Output: [[[[[[[[Ljava.lang.Character;@470e2030
May 01, 2016 10:12:52 AM org.netherrack.NetherServer main
INFO: Starting Minecraft server version 1.9.2
Exception in thread "main" java.lang.NoClassDefFoundError: org/bukkit/Material
at org.netherrack.world.generator.BedrockLayer.<init>(BedrockLayer.java:13)
at org.netherrack.world.generator.WavyGenerator.<init>(WavyGenerator.java:23)
at org.netherrack.NetherServer.main(NetherServer.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
package examples;
import java.util.HashMap;
/**
* Created by matthew on 12/04/16.
*/
public class AlessioAskedForAnExample {
public enum ExampleEnums {
public Boolean blockIsInjected(BlockType.BlockTypes bl) throws InvalidBlockTypeException {
switch (bl) {
case FIELD : return this.fieldsInjected;
case CONSTRUCTOR : return this.constructorsInjected;
case METHOD : return this.methodsInjected;
default : throw new InvalidBlockTypeException();
}
}