Skip to content

Instantly share code, notes, and snippets.

@Cacodaimon
Cacodaimon / client.js
Created October 22, 2012 17:55
WebSocket nodejs server & client tutorial used @ cacodaemon.de
module.exports.Client = function (name, socket) {
this.name = name
this.socket = socket
this.send = function (msg) {
this.socket.send(msg)
}
this.toString = function (msg) {
return this.name
@Cacodaimon
Cacodaimon / MiniHttp.js
Created November 7, 2012 21:39
A minimalistic http server for serving static files with Node.js. Used @ cacodaemon.de
/*
* A minimalistic http server for serving static files with Node.js.
* Don't use this in a production enviroment, this http server is not fast or secure!
*
* Autor: Guido Krömer <mail@cacodaemon.de>
* Page: www.cacodaemon.de
* Date: 2012-11-07
*/
module.exports.MiniHttp = function (path, port, ip, indexPage) {
var path = path;
@Cacodaimon
Cacodaimon / Session.js
Created November 11, 2012 14:59
Node.js Session handling, used @ cacodaemon.de
module.exports.Session = function () {
var getRandom = function () {
return Math.floor(Math.random() * 1e16).toString(36);
}
this.sessionId = getRandom() + '-' + new Date().getTime().toString(36) + '-' + getRandom();
this.doDestroy = false;
this.toString = function () {
return this.sessionId;
"use strict";
var User = require('./User.js').User;
var Message = require('./Message.js').Message;
var PrivateMessage = require('./Message.js').PrivateMessage;
var Command = require('./Message.js').Command;
var SessionHandler = require('./SessionHandler.js').SessionHandler;
module.exports.ChatServer = function (port, debug) {
var http = require('http');
var qs = require('querystring');
@Cacodaimon
Cacodaimon / ChatClient.js
Created November 23, 2012 14:43
Used @ cacodaemon.de
module.exports.ChatClient = function () {
if (module.exports.ChatClient.instance) {
return module.exports.ChatClient.instance;
}
module.exports.ChatClient.instance = this;
this.host = null;
this.welcomeTime = 0;
var interval = null;
@Cacodaimon
Cacodaimon / index.html
Created November 24, 2012 16:58
JSONP Example used @ cacodaemon.de
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSONP example</title>
<script>
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://cacodaemon.de/tutorials/jsonp_example.js';
document.getElementsByTagName('head')[0].appendChild(script);
@Cacodaimon
Cacodaimon / GameManager.js
Created December 3, 2012 00:54
Abstract game object class. (Used @ cacodaemon.de)
/*
* Simple JavaScript game manager.
*
* (c) 2012 Guido Krömer <mail@cacodaemon.de>
*
*/
function GameManager () {
var canvas = null;
var ctx = null;
var delta = 0;
@Cacodaimon
Cacodaimon / GameManager.js
Last active October 13, 2015 19:57
Simple untextured Raycaster example from cacodaemon.de
/*
* Simple JavaScript game manager.
*
* By Guido Krömer <mail@cacodaemon.de>
*
*/
function GameManager () {
var canvas = null;
var ctx = null;
var delta = 0;
@Cacodaimon
Cacodaimon / split_image.php
Created December 17, 2012 12:35
Creates some kind of combined image from a given set of images. Used @ cacodaemon.de
<?php
/**
* Creates some kind of combined image from a given set of images.
* All images should have the same resolution.
* Used and explained at www.cacodaemon.de
*
* Autor Guido Krömer
* E-Mail: mail<at>cacodaemon.de
*
*/
@Cacodaimon
Cacodaimon / GameManager.js
Last active November 13, 2018 23:04
JavaScript Canvas textured raycaster, used @ cacodaemon.de.
/*
* Simple JavaScript game manager.
*
* By Guido Krömer <mail@cacodaemon.de> 2013
*
*/
function GameManager () {
var canvas = null;
var ctx = null;
var delta = 0;