Skip to content

Instantly share code, notes, and snippets.

Ava Ryan forairan

Block or report user

Report or block forairan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@forairan
forairan / PhpJava.java
Last active Jul 7, 2019
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
View PhpJava.java
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@forairan
forairan / mysqlfix.sh
Last active Aug 29, 2015 — forked from handerson/mysqlfix.sh
MySQL CLI utilities from MySQL Workbench on OS X
View mysqlfix.sh
#MySQL Client
sudo ln -s /Applications/MySQLWorkbench.app/Contents/MacOS/mysql /usr/bin/mysql
#MySQL Dump
sudo ln -s /Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump /usr/bin/mysqldump
#How to fix the "Library not loaded: libmysqlclient.18.dylib (LoadError)" error
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
View spigot-patcher.sh
#!/bin/bash
## Get the right md5sum tool
if hash md5 2>/dev/null; then
MD5SUM="md5 -q"
else
MD5SUM="md5sum -b"
fi
## Validate arguments
@forairan
forairan / MetaTestPlugin.java
Last active Feb 1, 2017
Entity metadata memory leak test plugin
View MetaTestPlugin.java
package com.forairan.metatest;
import java.lang.reflect.Field;
import java.util.Map;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_7_R3.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
View CrashTestPlugin.java
package com.forairan.bukkit.test.conversationcrash;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.NullConversationPrefix;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.EventHandler;
@forairan
forairan / gist:8834021
Created Feb 5, 2014
HashMap/ConcurrentHashMap Performance Comparison
View gist:8834021
Testing HashMap with 100 objects...
.containsKey() - 6418 ns / 0.006418 ms
.get() - 10793 ns / 0.010793 ms
.put() - 9043 ns / 0.009043 ms
.remove() - 8751 ns / 0.008751 ms
Testing ConcurrentHashMap with 100 objects...
.containsKey() - 2625 ns / 0.002625 ms
.get() - 2334 ns / 0.002334 ms
.put() - 4667 ns / 0.004667 ms
.remove() - 15460 ns / 0.015460 ms
View VoidGenerator.java
package com.forairan.mapstudio.world;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
public class VoidGenerator extends ChunkGenerator {
@Override
View PotatoManager.java
package me.gusta.potato;
public class PotatoManager {
public List<Potato> potatoes = new ArrayList<Potato>();
public static void newPotato() {
Potato potato = new Potato();
potato.setHealth(20);
potato.setType(PotatoType.POTATO);
potato.potato(potato.getPotato());
You can’t perform that action at this time.