Skip to content

Instantly share code, notes, and snippets.


Hugo Manrique hugmanrique

View GitHub Profile
hugmanrique /
Last active Jun 11, 2016
Method used to order a Map<K, V extends Comparable>. Asked by @MxJesusDiaz at Twitter
* Orders a {@code Map<K, V>}
* @param map The {@link Map} that will be ordered (The value types must extend {@link Comparable})
* @param <K> The {@code K} value. Any type is supported
* @param <V> The {@code V} value. Must extend {@link Comparable}
* @return The sorted {@link Map} ordered by values with {@link Comparable#compareTo(Object)}
* @author Hugmanrique <>
* @see {@link Collections#sort(List)} to order the values
public static <K, V extends Sort.Comparable> Map<K, V> orderMapByValues(Map<K, V> map){

Keybase proof

I hereby claim:

  • I am Hugmanrique on github.
  • I am hugmanrique ( on keybase.
  • I have a public key whose fingerprint is 2C46 1B04 D946 B422 80F3 95C1 78E9 8DD2 FA2B 9E20

To claim this, I am signing this object:

hugmanrique / Octicons with Handlebars.js
Last active Oct 2, 2016
Node.js script to render octicons with a Handlebars template custom helper
View Octicons with Handlebars.js
const handlebars = require('express-handlebars');
const express = require('express');
// Directory where your compiled octicons are,
// more info on this @
const octicons = require('/home/nodeassets/octicons/index.js');
function loadServer(){
// Load express here
var app = express();
hugmanrique /
Last active Jan 14, 2017
Bukkit API to create smooth cinematics
public class Cinematic {
private JavaPlugin plugin;
private World world;
private List<CinematicView> views;
public Cinematic(JavaPlugin plugin, List<CinematicView> views, World world) {
this.plugin = plugin;
this.views = views; = world;
hugmanrique /
Last active Feb 6, 2022
Small ArmorStand animation created with the Bukkit API
public class SwordAnimation {
// Config variables
private static final float SEPARATOR = 2;
private static final float RAD_PER_SEC = 1.5F;
private static final float RAD_PER_TICK = RAD_PER_SEC / 20F;
private Location center;
private double radius;
private List<ArmorStand> swords;
hugmanrique /
Last active Jan 14, 2017
Apply gravity to your placed blocks in Minecraft
public class Gravity implements Listener {
private static final Vector GRAVITY = new Vector(0, -9.81F, 0);
private JavaPlugin plugin;
public Gravity(JavaPlugin plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
View regionBlockspom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""
hugmanrique /
Last active Jun 30, 2018
How to setup the NODE_ENV variable

NODE_ENV works like any other environment variable (e.g. PATH) and it depends on your platform how to set it:

  • Linux and OSX use the simple format NODE_ENV=production
  • Windows uses the SET NODE_ENV=production

You can explicitly set it before starting your npm run script by prepending the previous format:


hugmanrique / index.js
Last active Jul 1, 2018
Async Express middleware (for @exception)
View index.js
import http from 'http';
import express from 'express';
import testMiddleware from './middleware';
const app = express();
const server = http.createServer(app);
hugmanrique /
Last active Jul 31, 2018
Instanceof tests for private project (shared with @theminecoder)
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
* @author Hugo Manrique
* @since 31/07/2018
public class InstanceofTest extends PatchTest {