Skip to content

Instantly share code, notes, and snippets.

View DarkArc's full-sized avatar
🎲
Trying to do an infinite many things in finite time

Wyatt Childers DarkArc

🎲
Trying to do an infinite many things in finite time
View GitHub Profile
@DarkArc
DarkArc / ItemType.java
Last active December 19, 2015 10:59
This is a modified version of https://github.com/sk89q/worldedit/blob/master/src/main/java/com/sk89q/worldedit/blocks/ItemType.java. It contains better support for data values in ItemType and various fixes for the item name issue. It is not a directly compatible fix as it changes various aspects of the file that would be breaking from an API poi…
// $Id$
/*
* WorldEdit
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@DarkArc
DarkArc / gist:7381657
Created November 9, 2013 04:23
SeralizableItemStack
package com.skelril.aurora.util.item.itemstack;
import org.bukkit.Color;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@DarkArc
DarkArc / gist:7b518d8d54c4750a3252
Last active August 29, 2015 14:04
Anti Jump Component
import com.sk89q.commandbook.CommandBook;
import com.skelril.aurora.util.ChatUtil;
import com.skelril.aurora.util.LocationUtil;
import com.zachsthings.libcomponents.ComponentInformation;
import com.zachsthings.libcomponents.bukkit.BukkitComponent;
import com.zachsthings.libcomponents.config.ConfigurationBase;
import com.zachsthings.libcomponents.config.Setting;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@DarkArc
DarkArc / gist:481ed4438ddc51b7c3ca
Last active August 29, 2015 14:04
Distrusted Paste
public void paste(String newMirage) throws IOException, DataException, CommandException {
File file = getFile(newMirage);
if (!file.exists()) {
throw new FileNotFoundException();
}
EditSession editor = new EditSession(new BukkitWorld(world), -1);
// editor.setFastMode(true); Don't do this unless you plan to resend chunks later
CuboidClipboard clipboard = SchematicFormat.MCEDIT.load(file);
int maxX = clipboard.getWidth();
public static char loonyCharacter() {
switch (ChanceUtil.getRandom(7)) {
case 7:
return '?';
case 6:
return '&';
case 5:
return '!';
case 4:
public class SpongeBlockRegistry implements BlockRegistry<BlockSnapshot> {
private Map<BlockType, Integer> blockTypeMapping = new HashMap<>();
private List<List<Set<BlockTrait<?>>>> typeVariants = new ArrayList<>();
private List<BlockType> blockTypes = new ArrayList<>();
@Override
public BaseBlock getType(BlockSnapshot nativeType) {
BlockType targetType = nativeType.getState().getType();
Set<BlockTrait<?>> traitSet = new HashSet<>(nativeType.getState().getTraits());
@DarkArc
DarkArc / cleanup.sh
Created September 7, 2016 20:38
Cleanup Git Branch Cruft
git checkout master && git branch --merged | grep -v master | xargs git branch -d
@DarkArc
DarkArc / key_search.js
Last active September 16, 2016 19:37
Search up through an angular scope to find the object holding a given named scope variable
function findKey(searchObject, scopeVariableName) {
for (var objectKey in searchObject) {
if (objectKey === scopeVariableName) {
return searchObject;
} else if (objectKey === '$parent' && searchObject[objectKey] instanceof Object) {
if (searchObject.hasOwnProperty(objectKey)) {
var result = findKey(searchObject[objectKey], scopeVariableName);
if (result) {
return result;
}
@DarkArc
DarkArc / ClangUpdater.ps1
Last active July 10, 2020 18:26
CPPX Compiler Mono-repo MSVC Build
if (Test-Path "llvm-project") {
Push-Location "llvm-project"
git pull
Pop-Location
} else {
git clone --branch feature/metaprogramming https://github.com/lock3/meta.git llvm-project
}
if (!(Test-Path "build")) {
New-Item -ItemType Directory -Name "build"
@DarkArc
DarkArc / rename.py
Created April 16, 2020 04:38
A naive script to walk the current directory looking for Standard Notes txt files and renaming them to be either md or html files with cleaned up names
# Copyright (c) 2020 Wyatt Childers.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the