Skip to content

Instantly share code, notes, and snippets.

View maxov's full-sized avatar

Max Ovsiankin maxov

View GitHub Profile
@maxov
maxov / README.md
Last active January 1, 2016 08:49
Monads in LiveScript

This is an implementation of monads in a way that is pretty for LiveScript(given its amazing syntactic structures). This was originally a comment for LiveScript #426.

@maxov
maxov / README.md
Last active August 29, 2015 13:57
An explanation of how to share variables between Gulp and Grunt

Sharing variables between Gulp and Grunt

Gulp, while being a great build system, isn't perfect. Its plugin system is immature and not as full-featured as Grunt. I created gulp-grunt as a remedy for this problem, making it possible to import tasks from Grunt to gulp.

However, sometimes you want to use variables in both files. How? Well, use an accessory file to define all your variables, and import it from both.

@maxov
maxov / once.js
Created June 10, 2014 05:01
function that makes a function that only calls once
// do cb only once
function do_once(cb) {
var has_called = false;
// the function that is returned
return function () {
if(!has_called) {
cb.apply(arguments);
has_called = true;
}
}
@maxov
maxov / README.md
Last active August 29, 2015 14:04
A document outlining plans.

Marionette.Plans

In this document I hope to expose a new way of managing nested views and even routing/controllers in Marionette. This is rather opinionated, but hopefully in a good way. It provides a replacement for what are typically called 'controllers', which Marionette and Backbone don't have. In any case, it certainly makes Marionette more opinionated, but it does not in any way restrict users from doing certain things.

@maxov
maxov / gist:804ed227f979603b3c37
Last active August 29, 2015 14:06
An example of a simple sponge-based Component-Entity-System.
package org.spongepowered.api.
import java.util.*;
public class Hello {
public static void main(String[] args) {
EntityComponentSystem ecs = new EntityComponentSystem();
@maxov
maxov / gist:3d2c7e740fa3db20f97b
Last active August 29, 2015 14:06
Body-Component-System
// Represents a thing in the game world
interface Body {
int getID();
}
// Represents a behavior
interface Component {

Commands use-cases

So in thinking through the use-cases of commands w.r.t. Sponge I came uo with an algorithm for dealing with /command word conflicts.

I'm going to gloss over a few details that prepare the data structures in Sponge that hold information about the mapping of "command" to "plugin" off for a moment. I have another idea there... but for the problem scope limited to just de-conflicting:

Imagine each plugin is a node in a BST (binary search tree).

@maxov
maxov / mcmods.txt
Last active August 29, 2015 14:08
All MC Mods(in no particular order)
granite
husk
bukkit
sponge
rainbow
spigot
forge
trident
glowstone
vanilla
@maxov
maxov / mcbiomes.txt
Created October 27, 2014 03:33
mc biomes
Biomes
====
River
Ocean
Extreme Hills
Nether
The End
Frozen Ocean
Frozen River
@maxov
maxov / aquifer-package-client.js
Last active August 29, 2015 14:08
Aquifer package format
// a client-side package (nudge nudge wink wink)
{
"name": "my-name",
"owner": "org-or-user",
"version": "0.5.0",
"paths": {
"artifact": "builds/my-name-*.jar",
"docs": "docs/"
},
"dependencies": {