Skip to content

Instantly share code, notes, and snippets.

Rocket Science

Christian Engel Paratron

Rocket Science
Block or report user

Report or block Paratron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View isofix.js
* Renders the tiles to the layer canvas and pushes to the display.
* @method Phaser.TilemapLayer#render
* @memberof Phaser.TilemapLayer
Phaser.TilemapLayer.prototype.render = function () {
if (this.layer.dirty)
this.dirty = true;
Paratron / twig_init.php
Created Aug 7, 2014
Twig Template Engine Bootstrap
View twig_init.php
$loader = new Twig_Loader_Filesystem('lib/templates');
$twig = new Twig_Environment($loader);
Paratron / door.js
Created Oct 16, 2014
Alternative constructor prototype
View door.js
var Door = function Door(){
Door.prototype = {
constructor: Door,
name: 'Door',
hp: 5,
char: '+',
color: 'yellow',
Paratron / gist:3027785
Created Jul 1, 2012
Suggestion for basic AppJS structure.
View gist:3027785
//Previously, you first required appjs, then called appjs.init(), which returns an app object. We can merge that into just one step.
var app = require('appjs');
//This is the basic way to call a window. You pass either a string with the URL of the window content, or you pass a full object, if you want to set more options.
var main_window = app.createWindow({
url: 'http://appjs/main.html',
width: 640,
height: 480,
maximizable: false
Paratron / gist:3236143
Created Aug 2, 2012
Get id attribute of all elements with a certain class.
View gist:3236143
//Without jQuery
var elements = document.getElementsByClassName('clicked'), //Be careful: won't work in IE 6,7,8
ids = [];
for(var i = 0; i < elements.length; i++){
View Two jQuery

Two jQuery Plugins for you

Hey, I wanted to share two jQuery Plugins we created for the promotional website for Spritepad. We needded two things there:

###Displacement The starscape background and some elements of the page should scroll at a different speed as the page, to achieve a fake 3D effect.

###Reaction on user scrolling We wanted some elements to appear on screen at the moment the user scrolls far enough that they have moved into the view area.

View Short Timer.js
* Short Countdown
* ===============
* This is my try of a short JavaScript Countdown.
* Line breaks and identation added for better reading.
* Line 2 could be boiled down to:
* e = +new d()+36E5;
* But the way it is right now makes it much easier to tweak the duration.
* Character count with whitespace trimmed: 178.
View cargo_draft.js
//Cargo Asset Loader
//This file defines the API for a HTML5 asset loader that is mainly designed to be used for games
//but could be used for any kind of HTML5 application that requires some kind of asset management.
//@version: 1 (April 1st, 2013)
//@author: Christian Engel <>
//The Cargo asset loader should deliver the following number of features:
Paratron / raf-polyfill.js
Created Apr 29, 2013
A Polyfill for window.requestAnimationFrame()
View raf-polyfill.js
(function() {
var lastTime = 0;
var vendors = ['webkit', 'moz'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame =
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
if (!window.requestAnimationFrame)
Paratron / undo_redo.js
Created Jul 31, 2013
Easy undo/redo with backbone
View undo_redo.js
this.on('change', function(){
undo: function(){
redo: function(){
You can’t perform that action at this time.