Skip to content

Instantly share code, notes, and snippets.

View NocturnDragon's full-sized avatar

X NocturnDragon

View GitHub Profile
@NocturnDragon
NocturnDragon / local_opaque_object.c
Created July 18, 2018 15:41 — forked from keebus/local_opaque_object.c
Local opaque object in C
// library.h -------------------------------------------------------------------
#define opaque(Type) Type; int $sizeof_##Type(void);
#define opaque_impl(Type) int $sizeof_##Type(void) { return sizeof(Type); }
#define local(Type) ((Type *)alloca($sizeof_##Type()))
// foo.h -----------------------------------------------------------------------
@NocturnDragon
NocturnDragon / Doc.md
Created January 10, 2018 20:01 — forked from dwilliamson/Doc.md
Minimal Code Generation for STL-like Containers

This is my little Christmas-break experiment trying to (among other things) reduce the amount of generated code for containers.

THIS CODE WILL CONTAIN BUGS AND IS ONLY PRESENTED AS AN EXAMPLE.

The C++ STL is still an undesirable library for many reasons I have extolled in the past. But it's also a good library. Demons lie in this here debate and I have no interest in revisiting it right now.

The goals that I have achieved with this approach are:

@NocturnDragon
NocturnDragon / Pimpl.cpp
Created April 17, 2017 16:58 — forked from dwilliamson/Pimpl.cpp
How I Pimpl
struct Data
{
Data()
{
}
~Data()
{
}
@NocturnDragon
NocturnDragon / Jinja module loader.md
Created February 15, 2017 22:45 — forked from voscausa/Jinja module loader.md
Jinja2 compiled templates module loader for App Engine Pyhton 2.7.

Jinja compiled templates module loader

This code is part of a Jinja CMS for Google App Engine Python 2.7 and NDB datastore

A Jinja enviroment is created for every CMS site: site_key_id = 'example

The modules are created using compiler.py The resulting code objects are stored in the dadastore using Kind Runtimes and a BlobProperty

The modules can also be saved / downloaded as .pyc in a zip archive: -compiled-templates.zip

@NocturnDragon
NocturnDragon / PCG.md
Last active August 29, 2015 14:25 — forked from mrcasals/PCG_AI.md
PCG interesting links - nucl.ai

If you want to add links here, leave a comment or ping me by Twitter or GitHub (@mrcasals on both platforms). You can find my email in my GitHub profile too!

Books

Talks & Conference-related stuff

class FileWatcher
{
public:
FileWatcher(const Path& path)
: m_Path(path)
, m_DirHandle(INVALID_HANDLE_VALUE)
, m_BufferSize(CORE_KB(100))
, m_Buffer(nullptr)
, m_ChangedFiles(1024)
{
#
# © 2011 Christopher Arndt, MIT License
#
# Taken from: http://wiki.python.org/moin/PythonDecoratorLibrary
import time
class cached_property(object):
'''Decorator for read-only properties evaluated only once within TTL period.