Skip to content

Instantly share code, notes, and snippets.

@MKelm
MKelm / lgogdinstall.sh
Last active October 10, 2015 11:05
Install lgogdownloader and lgogd_uri on Linux Ubuntu 14.04 / Mint 17.1
#/bin/sh
mkdir lgogd && cd lgogd &&\
sudo add-apt-repository ppa:nilarimogard/webupd8 &&\
sudo apt-get update &&\
sudo apt-get install -f lgogdownloader &&\
wget https://github.com/ssokolow/lgogd_uri/archive/master.tar.gz &&\
tar -xvzf master.tar.gz &&\
cd lgogd_uri-master && ./install.sh
@MKelm
MKelm / DungeonGenerator.js
Last active August 29, 2015 14:02
Unity4 Dungeon Generator Script
#pragma strict
// reference code http://bigbadwofl.me/random-dungeon-generator
public var GroundPlane : Transform; // ground plane with 1x1 size
public var WallCube : Transform; // wall cube with 1x1x1 size
public var MapSizeX : int = 100; // max x units
public var MapSizeZ : int = 100; // max z units
@MKelm
MKelm / test.html
Created August 2, 2013 20:56
Prototyping speed test (prototyping 19,6x faster in node-webkit)
<!DOCTYPE HTML>
<html>
<head>
<title>Test Prototyping</title>
<script language="javascript">
var X,Y, x,y, i, intNow;
X = function() {};
X.prototype.message = function(s) { var mymessage = s + "";}
X.prototype.addition = function(i,j) { return (i *2 + j * 2) / 2; }
@MKelm
MKelm / dynpng.php
Last active December 20, 2015 11:19
dynamic php png image with size / alpha / color parameter
<?php
header("Content-Type: image/png");
$size = isset($_GET['size']) ? $_GET['size'] : 1;
$alpha = isset($_GET['alpha']) ? $_GET['alpha'] : 0;
$hex = (isset($_GET['color']) && strlen($_GET['color']) == 6) ? $_GET['color'] : "000000";
$im = @imagecreatetruecolor($size, $size) or die('error');
imagesavealpha($im, true);
imagefill($im, 0, 0, "0x".dechex(ceil($alpha * 127)).$hex);
imagepng($im);
@MKelm
MKelm / gist:6102631
Last active December 20, 2015 08:48
Example / idea for MCT scneario definition file (JSON)
{
"meta" : {
"title" : "The invisible agents",
"description" : "Get the highest market position on three planets and work for the invisible agents."
},
"global" : {
"maxPlanets" : 3
},
"events" : {
"poolSomeRandom" : {
@MKelm
MKelm / mct greenlink banner.html
Created July 25, 2013 21:37
Greenlink banner code for "Mass Control Tycoon" Steam Greenlight profile
@MKelm
MKelm / mct greenlink widget.html
Last active December 20, 2015 06:09
Greenlink widget code for "Mass Control Tycoon" Steam Greenlight profile
@MKelm
MKelm / gist:5817196
Created June 19, 2013 19:24
Correct .htaccess for papaya CMS
RewriteEngine On
#remove session id
RewriteRule ^/?sid[a-z]*([a-zA-Z0-9,-]{20,40})(/.*) $2 [QSA]
#admin pages
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?papaya/module\_([a-z0-9\_]+)\.[a-z]{3,4} /papaya/module.php?p_module=$1 [QSA,L]
@MKelm
MKelm / gist:5801678
Last active December 18, 2015 15:08
Change line 12 in papaya-data/templates/default-xhtml/html/base/dialogs.xsl to avoid input-/token-errors with dynamic textareas in community - content_register/content_profile ...
<xsl:template name="dialog-element-textarea">
<xsl:param name="element" />
<xsl:param name="elementId" select="generate-id($element)"/>
<textarea>
<xsl:copy-of select="$element/@*[name() = 'name' or name() = 'class' or name() = 'rows' or name() = 'cols']" />
<xsl:attribute name="id"><xsl:value-of select="$elementId"/></xsl:attribute>
<xsl:choose>
<xsl:when test="$element/node()">
<xsl:apply-templates select="$element/node()"/>
</xsl:when>
@MKelm
MKelm / gist:5699335
Created June 3, 2013 16:24
Beautified (http://jsbeautifier.org) minified-source of jQuery lightBox plugin (http://leandrovieira.com/projects/jquery/lightbox), use http://jscompress.com/ to minify again, get the full lightBox 0.5 package here http://idx.shrt.ws/lightbox.download.9229f618b9fe5f6a78252557a5c8bbc3v2.zip
/**
* jQuery lightBox plugin
* This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
* and adapted to me for use like a plugin from jQuery.
* @name jquery-lightbox-0.5.js
* @author Leandro Vieira Pinho - http://leandrovieira.com
* @version 0.5
* @date April 11, 2008
* @category jQuery plugin
* @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)