Skip to content

Instantly share code, notes, and snippets.

View BonsaiDen's full-sized avatar

Ivo Worms BonsaiDen

View GitHub Profile
@BonsaiDen
BonsaiDen / DarkSoulsWeapons.js
Created November 17, 2012 15:41
Dark Souls Weapons Data in JSON form (scraped from: http://darksoulswiki.wikispaces.com/Weapons )
[{
"name": "Dagger",
"atk": {
"physical": 56,
"magic": 0,
"fire": 0,
"lightning": 0,
"bonus": 131
},
"def": {
@BonsaiDen
BonsaiDen / require.js
Last active December 12, 2015 00:58
A straigtforward Node.js require() implementation for browsers
/**
* 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:
*

Asynchronous Ping Measurement

Below is a simple description of how to implement a two way ping measuring which calculates the values for both server -> client and client -> server, as these can differ on asymmetric routes.

To work around clock differences, the system uses the date and time of the initial connection as it's origin.

Each side will calculate their roundtrip to the respective remote, and will then transmit it to them in order to create a shared state of the roundtrip time information.

@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;
@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 / 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 / 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 / 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 / ios.js
Created August 5, 2013 19:30
IOS stuff
(function(window) {
var ios = {
onload: function() {
},
width: 0,
height: 0,
@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": [{