This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This benchmark compares two ways of creating objects. | |
-- Output commonly seen on the Lua demo site: | |
-- | |
-- Creation time: 0.16 | |
-- Calling member function time: 0.11 | |
-- Memory: 2868.8798828125 | |
-- | |
-- Creation time: 0.11 | |
-- Calling member function time: 0.13 | |
-- Memory: 1697.4736328125 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Object is the base class of anything that follows this OOP mechanism. | |
-- Usage example: | |
-- | |
-- | |
-- CREATING A DERIVED CLASS | |
-- | |
-- local Human = Object:subclass { | |
-- name = "Anonymous", | |
-- weight = 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
local function checkenv(varname) | |
local value = os.getenv(varname) | |
if not value then | |
print(varname .. ' not set') | |
os.exit(1) | |
end | |
return value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DURATIONLOGGER_H | |
#define DURATIONLOGGER_H | |
#include <QTime> | |
/** | |
* A helper class that logs the duration of a specific scope. | |
*/ | |
class DurationLogger | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QImage readDDSFile(const QString &filename) | |
{ | |
QGLWidget glWidget; | |
glWidget.makeCurrent(); | |
GLuint texture = glWidget.bindTexture(filename); | |
if (!texture) | |
return QImage(); | |
// Determine the size of the DDS image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filename : Image2Map.py | |
# Authors : Georg Muntingh and Bjorn Lindeijer | |
# Version : 1.2 | |
# Date : June 16, 2010 | |
# Copyright : Public Domain | |
import os, sys, Image, networkx | |
class TileMap: | |
""" This class represents a map of tiles. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# | |
# Warning: this script will delete the given container, including its contents | |
# | |
from argparse import ArgumentParser | |
from os import environ | |
from sys import exit | |
from libcloud.storage.types import Provider, ContainerDoesNotExistError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am bjorn on github. | |
* I am bjorn (https://keybase.io/bjorn) on keybase. | |
* I have a public key whose fingerprint is F0F4 30DC 9685 89CA C31D 17B4 10B2 90EF C9F1 1EB9 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FlexibleScrollBar : public QScrollBar | |
{ | |
Q_OBJECT | |
public: | |
FlexibleScrollBar(Qt::Orientation orientation, QWidget *parent = nullptr) | |
: QScrollBar(orientation, parent) | |
, mOverrideMinimum(0) | |
, mOverrideMaximum(0) | |
, mDesiredMinimum(0) |
OlderNewer