Skip to content

Instantly share code, notes, and snippets.

View apples's full-sized avatar
🏳️‍🌈

Apples apples

🏳️‍🌈
View GitHub Profile
@apples
apples / efraimidis_spirakis.cpp
Created May 5, 2020 06:03
Implementations of algorithms A-Res and A-ExpJ from Efraimidis and Spirakis.
#include <iostream>
#include <random>
#include <vector>
#include <queue>
#include <cmath>
#include <array>
#include <algorithm>
#include <iterator>
/*
@apples
apples / linq.lua
Created March 4, 2020 06:10
Lua implementation of some common LINQ methods.
local linq = {}
local where_iter = {}
local select_iter = {}
local concat_iter = {}
local drop_iter = {}
-- linq base
linq.__index = linq
@apples
apples / PKGBUILD
Created September 11, 2019 04:05
RE/flex msys2 pkgbuild
_realname=reflex
pkgbase=mingw-w64-x86_64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.4.0
pkgrel=1
pkgdesc="Regex-centric, fast lexical analyzer generator for C++ with full Unicode support (mingw-w64)"
arch=('any')
url="https://www.genivia.com/doc/reflex/html/index.html"
license=('BSD-3')
depends=()

Database usertype

#include <ginseng/ginseng.hpp>
#include <sol.hpp>

auto create_ginseng_usertype(sol::state_view& lua) -> sol::simple_usertype<ginseng::database> {
    using ginseng::database;
    using ent_id = database::ent_id;
    

Backend renderer interface:

class render_context {
public:
    virtual ~render_context() = 0;
    virtual void begin() = 0;
    virtual void end() = 0;
 virtual void draw_rectangle(const std::string&amp; texture, glm::vec2 position, glm::vec2 size) = 0;
@apples
apples / vdom.lua
Last active March 4, 2020 06:21
Lua virtual DOM implementation (based on v1.0 of https://github.com/pomber/didact). NOW WITH HOOKS!
local linq = require('linq')
local class = require('class')
local component_base = class()
local function assign(dest, source)
for k,v in pairs(source) do
dest[k] = v
end
return dest
@apples
apples / dynamic_bitset.hpp
Last active July 29, 2018 22:05
Dynamic bitset
#include <bitset>
#include <cstddef>
class dynamic_bitset {
public:
using size_type = std::size_t;
static constexpr size_type word_size = 64;
using bitset = std::bitset<word_size>;
@apples
apples / document.md
Created May 20, 2017 22:01
Internet Security Starter Kit

placeholder

#ifndef BRAEBURN_RESOURCECACHE_HPP
#define BRAEBURN_RESOURCECACHE_HPP
#include <memory>
#include <string>
#include <unordered_map>
#include <typeindex>
namespace braeburn {
#ifndef RASPBERRY_HPP
#define RASPBERRY_HPP
#include <memory>
#include <utility>
#define DECL_ERASURE_MEMBER_CONCEPT(ConceptName, FuncName) \
template <typename Func> \
struct ConceptName; \
template <typename R, typename... Args> \