Skip to content

Instantly share code, notes, and snippets.

View zkbpkp's full-sized avatar

Daniil Kolesnichenko zkbpkp

  • Moscow, Russian Federation
View GitHub Profile
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
typedef struct {
int baz;
} bar;
typedef struct {
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module ByteEnum (ByteEnum, toByte, fromByte, fromByteAll, allValues, enum) where
import Data.Word (Word8)
import Language.Haskell.TH
class ByteEnum e where
toByte :: e -> Word8
@zkbpkp
zkbpkp / adt.js
Last active August 20, 2017 18:45
const tag = Symbol();
const data = (variants, extend = class {}) => {
const obj = class extends extend {};
for (const v in variants) {
let cargs;
obj[v] = (...args) => new (class extends obj {
constructor(...args) {
super();
@zkbpkp
zkbpkp / init.vim
Created February 28, 2017 21:14
My vimrc (for vim and neovim)
set nocompatible
set runtimepath+=~/.config/nvim/repos/github.com/Shougo/dein.vim
let s:bundle_dir = expand('~/.config/nvim')
let s:plugin_dir = s:bundle_dir . '/repos/github.com'
if dein#load_state(s:bundle_dir)
call dein#begin(s:bundle_dir)
" --- Dein ---