Skip to content

Instantly share code, notes, and snippets.

View KAYLukas's full-sized avatar

KAYLukas

  • Google
  • Zurich
View GitHub Profile
class X{
public function __construct(){
$this->x = this;
}
}
class Mock{
private $context;
public function __construct($a){
$this->context = new Context($a);
}
public function __destruct(){
Context::destroyContext($this->context);
@KAYLukas
KAYLukas / ChangeListener.py
Created February 12, 2013 18:16
Event driven library updating
import resources.lib.utils as utils
import xbmc
from ctypes import *
block_duration = 60*1000#1 minute
#Listens for changes in the selected libraries.
#If a change occurs in some folder of some library all
#selected libraries are updated.
def listen():
@KAYLukas
KAYLukas / gist:4139978
Created November 24, 2012 14:52
original code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.docpresso.templating;
import org.docpresso.util.Tuples.Pair;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.Scriptable;
@KAYLukas
KAYLukas / fps.cpp
Created June 27, 2012 12:35
new fps implementation
double frame(){
double t = glfwGetTime();
static double oldt;
double dt = t - oldt;
oldt = t;
static double time_between_frames;
//Determine the weight on the amount of fps, so that every second always has a equal weight.
int weight = (int) (1.0/time_between_frames);
weight /= 10;
if(weight < 3){
@KAYLukas
KAYLukas / glfwtest.cpp
Created June 26, 2012 20:33
glfw testje
//
// main.cpp
// GLFWtest
//
// Created by Kay Lukas on 26-06-12.
// Copyright (c) 2012 TU/e. All rights reserved.
//
#include <iostream>
#include <GL/glfw.h>
@KAYLukas
KAYLukas / MessageDisplayer::draw().cpp
Created June 16, 2012 16:35
MessageDisplayer met stroking characters
void MessageDisplayer::draw(){
glRasterPos2i(xOffset, yOffset);
//Loop through all messages, starting with the first added one
//up to the last added one
for(int i=0; i < 10; i++){
int ai = (curr+i)%10;
Handle<DisplayMessage> mh = messages[ai];
if(!mh) continue;
DisplayMessage *m = &*mh;