Skip to content

Instantly share code, notes, and snippets.

@profan
profan / thing.d
Last active July 17, 2016 15:18
more declarative opengl
import std.typecons : tuple;
import std.stdio;
import std.meta;
import derelict.sdl2.sdl;
import gland.win;
import gland.gl;
import util;
@profan
profan / ilist.d
Last active February 15, 2016 05:29
Intrusive single linked list, wouldn't recommend anyone actually use it :D
/**
* Intrusive single linked list, uses next pointer already present in the type
* to avoid extra dynamic memory allocation.
*/
struct ILinkedList(T) {
T* head_;
void add(T* item) {
@profan
profan / scopedbuf.d
Created October 29, 2015 01:32
scoped buffer?
struct ScopedBuffer(T) {
private IAllocator allocator_;
private {
T[] buffer_;
}
@profan
profan / allocs.c
Last active December 5, 2020 21:52
awful allocation tracking macro
#include <stdlib.h>
#include <stdio.h>
struct Node {
size_t attempted_allocations;
size_t successful_allocations;
size_t size;
struct Node* next;
@profan
profan / keybase.md
Last active August 29, 2015 14:02
keybase things

Keybase proof

I hereby claim:

  • I am profan on github.
  • I am profan (https://keybase.io/profan) on keybase.
  • I have a public key whose fingerprint is 1798 B62C B04E F796 5A68 BED3 A350 4CCE 50E5 110D

To claim this, I am signing this object:

@profan
profan / keyeventmanager
Created May 22, 2014 21:40
Key Event Manager
#ifndef VOX_KEYEVENTMANAGER_HPP
#define VOX_KEYEVENTMANAGER_HPP
#include "easylogging++.h"
#include "Keyboard.hpp"
#include "KeyNew.hpp"
#include <SDL2/SDL.h>
#include <vector>
#include "Profiler.h"
@profan
profan / findFunction
Last active August 29, 2015 13:57
Search for a function through table, print names of matching functions.
function findFunction(search_table, funcname)
for k, v in pairs(search_table) do
if type(v) == "table" then
for i, l in pairs(v) do
if type(l) == "function" then
if string.match(i, funcname) then
io.write(k .. ".".. i .. "\n");
end
end
end