Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Foldable diffs
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Adds a fold button to file diffs, and folds deleted files by default
// @author gigaherz
// @match https://bitbucket.org/*
// @grant none
// ==/UserScript==
@gigaherz
gigaherz / code.json
Last active July 8, 2017 15:52
A concept for a JSON-encoded Java AST
{
"PROGRAM": "Name here",
"VERSION": "1.0",
"Program": {
"TYPE": "class",
"SUPER": "Application",
"ATTRIBUTES": [ "public", "static"],
"FORMAT": 1,
"MEMBERS": {
@gigaherz
gigaherz / IDEA.md
Last active October 13, 2020 17:46

Terminal-free IntelliJ IDEA configuration

These instructions assume that you have created the project folder as described in the Getting Started page, and are meant to be used in place of steps 4+ of that page.

  1. Launch IDEA and choose to open/import the build.gradle file, using the default gradle wrapper choice. While you wait for this process to finish, you can open the gradle panel, which will get filled with the gradle tasks once importing is completed.
  2. Run the setupDecompWorkspace task (inside the forgegradle task group). It will take a few minutes, and use quite a bit of RAM. If it fails, you can add -Xmx3G to the Gradle VM options in IDEA's gradle settings window, or edit your global gradle properties.
  3. Once the setup task is done, you will want to run the genIntellijRuns task, which will configure the project's run/debug targets.
  4. After it's done, you should click the blue refre
{
"__comment": "It may be best to have a difference between localization keys, and actual display strings",
"name": "entity.creeper.name",
"__comment": "User-defined 'team', useful for distinguishing enemies",
"faction": "creeper",
"initial_state": "wander",
"states": {

I want to show you why the capabilities work the way they work, and not just how they work.

The following explanation is not meant to be accurate with reality, only a way to form the necessary connections and be able to understand one possible reasoning for the design.

I will try my best.

Backstory

Once upon a time, every API would define a bunch of interfaces that people would implement

package gigaherz.packingtape.cap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemStackHandler;
/**
* Created by gigaherz on 06/08/2016.
*
* This class is the feature we want to attach to the player.
package gigaherz.enderRift.common.container;
import net.minecraft.item.ItemStack;
public interface IItemHandlerContainer
{
boolean isItemValidForSlot(int slot, ItemStack stack);
int getInventoryStackLimit(int slot);
}
package gigaherz.enderthing.client;
import com.google.common.collect.Maps;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
@gigaherz
gigaherz / 00. Description.md
Last active April 24, 2016 10:57
Thoughts on a semantic description for user interfaces, where the UI engine and theme decide the actual layout and controls used.

Semantic UI

Semantic UI represents a description of an user interface, in terms of 'what', and not 'how'.

Each element in the description consists of an identifier, a set of attributes, and a set of children.

##Syntax uses in the examples

The example syntax uses an indent-delimited format, with the character '#' indicating a comment until the end of the line. Multi-line comments start with '#[' and end with ']#', and nesting is allowed.

This document describes an hypotetical type hierarchy for a non-existing environment.
It has been inspired by the CLR, JVM, and some IRC conversations.
Type tree:
----------
Any
Void
Value
Primitive