Skip to content

Instantly share code, notes, and snippets.

View BonsaiDen's full-sized avatar

Ivo Worms BonsaiDen

View GitHub Profile
@BonsaiDen
BonsaiDen / vim.parser.js
Created October 30, 2013 23:19
Basic VIM Key Sequence Parser in JS
/**
* Copyright (c) 2013 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / box.md
Last active February 16, 2022 20:36
Doc Markdown

Box.round( Float v ) ⇢ Integer

Rounds the given float to a integer, this function is intended for rendering purposes and tries to reduce jitter.

Box.World( Vec2 gravity = Vec2(0.0, 50.0), Integer steps = 10, Integer iterations = 10 )

@BonsaiDen
BonsaiDen / orderedmap.mia.json
Last active December 21, 2015 09:39
Mia testing
{
"name": "OrderedMap",
"exports": {},
"related": {},
"internal": {
"OrderedMap": {
"type": "Class",
"id": 81,
"name": "OrderedMap",
"comment": null,
@BonsaiDen
BonsaiDen / mia.json
Last active December 21, 2015 06:09
Mia output for prototypical code with mia annotations.
{
"name": "Module",
"exports": {
"Module.External": {
"type": "Class",
"id": 52,
"name": "External",
"comment": {
"description": "The External Class",
"params": [{
@BonsaiDen
BonsaiDen / ios.js
Created August 5, 2013 19:30
IOS stuff
(function(window) {
var ios = {
onload: function() {
},
width: 0,
height: 0,
@BonsaiDen
BonsaiDen / box.js
Last active February 16, 2022 20:35
Simple physics engine optimized for oldschool platformers. Feel free to integrate the missing pieces to support circles and arbitrary polygons.
/**
* Copyright (c) 2013 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / box.js
Created August 2, 2013 23:18
Really simple AABB only physics engine.
(function(exports) {
// Vector Class -----------------------------------------------------------
// ------------------------------------------------------------------------
function Vector2(x, y) {
this.x = x;
this.y = y;
}
Vector2.prototype = {
@BonsaiDen
BonsaiDen / ObjectPool.js
Created July 18, 2013 15:49
Simple object pool with O(1) creation / deletion
/**
* Copyright (c) 2013 Ivo Wetzel.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BonsaiDen
BonsaiDen / namegen.js
Last active August 26, 2020 08:42
Planet Name Generator thing
function NameGenerator(state) {
// Syllables shamelessly stolen from elite
var syllables = 'folexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion',
vocals = 'aeiou';
// Some improvements
var vocalMustFollow = 'tdbr',
notFollowdBySelf = 'rstie',
onlyAtStart = 'xyz',
@BonsaiDen
BonsaiDen / lexer.js
Created April 29, 2013 19:43
Emblem Lexer
var rules = require('./rules');
// Emblem Lexer ---------------------------------------------------------------
// ----------------------------------------------------------------------------
var Lexer = function() {
this.line = 0;
this.col = 0;
this.offset = 0;