Skip to content

Instantly share code, notes, and snippets.

@lightsfury
lightsfury / enum_class_hack_snippet.cxx
Created July 15, 2012 03:11
[C++] Enum class hack
#ifndef CXX_NO_ENUM_CLASS
// We have enum class
/**
Unified interface to the ENUM_CLASS macro. You should NOT leave a trailing comma (`,`).
@note We use a variadic macro to avoid hackery with enum members.
**/
#define ENUM_CLASS(name, type, ...) \
enum class name : type { \
__VA_ARGS__, }
@lightsfury
lightsfury / serve-jsonp.php
Created May 29, 2012 03:55
Serve JSONP in php
<?php
header('Content-type: application/javascript; charset=utf-8');
function getJSON($path)
{
return file_get_contents($path);
}
function getJSONP($path, $callback)
{