Skip to content

Instantly share code, notes, and snippets.

@parasyte
parasyte / menu.js
Last active December 29, 2015 03:39
Implementing a minimal, recursive menu system in melonJS.
game.MenuItem = me.GUI_Object.extend({
init : function (settings) {
this.pos = new me.Vector2d(settings.x, settings.y);
this.image = me.loader.getImage(settings.image);
this.parentMenu = settings.parentMenu;
this.subMenu = settings.subMenu;
this.callback = settings.callback;
this.name = "MenuItem";
},
@parasyte
parasyte / n64_tlb.txt
Created September 13, 2013 05:25
N64 TLB
FORMATS
EntryLo0 & EntryLo1:
00 pppppppppppppppppppppppp ccc d v g
(32-bit: 2.24.3.1.1.1)
p = Page frame number; the upper bits of the physical address.
c = Specifies the TLB page coherency attribute. (See below)
d = Dirty. If this bit is set, the page is marked as dirty and, therefore, writable
This bit is actually a write-protect bit that software can use to prevent alteration
@parasyte
parasyte / hll.py.patch
Created June 20, 2013 19:11
Memory and CPU optimized HyperLogLog (Python) patch Original: https://github.com/svpcom/hyperloglog
diff --git a/hyperloglog/hll.py b/hyperloglog/hll.py
index cb6b6bc..a16b730 100755
--- a/hyperloglog/hll.py
+++ b/hyperloglog/hll.py
@@ -1,5 +1,7 @@
"""
-This module implements probabilistic data structure which is able to calculate the cardinality of large multisets in a single pass using little auxiliary memory
+This module implements a probabilistic data structure which is able to calculate
+the cardinality of large multi-sets in a single pass using little auxiliary
+memory.
@parasyte
parasyte / README.md
Last active December 17, 2015 19:21
PubNub pam.py

REST API

The REST API provides secure administrative tasks for managing and auditing permissions (aka Access Control List, or ACL). All of the REST APIs require a cryptographic signature and a timestamp that is reasonably close to NTP time.

Timestamp

The timestamp is an HTTP query parameter following the Unix Time convention

@parasyte
parasyte / mp.js
Last active December 16, 2015 07:39
Multiplayer example for melonJS with PubNub
var Multiplayer = Object.extend({
init : function (new_player) {
this.pubnub = PUBNUB.init({
publish_key : 'demo',
subscribe_key : 'demo'
});
this.new_player = new_player;
// Record my UUID, so I don't process my own messages
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
x, y := 0, 1
return func() int {
x, y = y, x + y