Skip to content

Instantly share code, notes, and snippets.

@vittorioromeo
vittorioromeo / hello_triangle.cpp
Created October 10, 2015 11:07
SDL2 + OpenGL ES 2.0 - "Hello triangle" example that works both on X11 and Emscripten
#include <exception>
#include <functional>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <thread>
#include <mutex>
#include <condition_variable>
// https://github.com/meganz/mingw-std-threads
#include "./mingw-std-threads/mingw.thread.h"
#include "./mingw-std-threads/mingw.mutex.h"
#include "./mingw-std-threads/mingw.condition_variable.h"
#define BOOST_THREAD_PROVIDES_FUTURE 1
@vittorioromeo
vittorioromeo / qtcreator_monokai.xml
Created May 11, 2016 20:05
monokai theme for qtcreator
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="veeMonokai (copy)">
<style name="Text" foreground="#e6e5e2" background="#1e201a"/>
<style name="Link" foreground="#66d9ef"/>
<style name="Selection" foreground="#e6e5e2" background="#49483e"/>
<style name="LineNumber" foreground="#a0a19c" background="#272822"/>
<style name="SearchResult" foreground="#ffffff" background="#2572b8"/>
<style name="SearchScope" foreground="#000000" background="#e2efff"/>
<style name="Parentheses" foreground="#ff0000" background="#515d6a"/>
<style name="CurrentLine" background="#3e3d32"/>
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignOperands: true
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
#include <array>
#include <atomic>
#include "./blockingconcurrentqueue.h"
using namespace std::chrono_literals;
// global counter
// * the program can exit when it reaches 1000
// * incremented by tasks
std::atomic<int> ctr{0};
Linux laptop-name 4.7.5-1-ARCH #1 SMP PREEMPT Sat Sep 24 13:04:22 CEST 2016 x86_64 GNU/Linux
#include <iostream>
#include <vector>
#include <boost/variant.hpp>
namespace impl
{
struct vnum_wrapper;
using varr = std::vector<vnum_wrapper>; // <- indirection here
using vnum = boost::variant<int, varr>;
#include <type_traits>
#include <experimental/type_traits>
template <typename T, typename TVoid = void>
struct is_overloaded : std::true_type { };
template <typename T>
struct is_overloaded<T, std::void_t<decltype(&std::decay_t<T>::operator())>>: std::false_type { };
struct s0
#include <utility>
struct root
{
template <typename TNode, typename... TNodes>
void start(TNode& n, TNodes&... ns) &
{
n.execute(ns...);
}
};
.title {
margin-top: 8px !important;
}
.tab-bar {
height: 30px !important;
}
.tab {
height: 30px !important;