Skip to content

Instantly share code, notes, and snippets.

View rmartinho's full-sized avatar

R. Martinho Fernandes rmartinho

View GitHub Profile
" Sets up multi-language syntax for Jekyll blog posts
fun! SetJekyllPostSyntax()
" Bring in YAML syntax for front matter
unlet b:current_syntax
syntax include @Yaml syntax/yaml.vim
syntax region yamlFrontmatter start=/\%^---$/ end=/^---$/ keepend contains=@Yaml
" Bring in C++11 syntax for code snippets
unlet b:current_syntax
syntax include @Cpp syntax/cpp11.vim
@rmartinho
rmartinho / darray2d.h
Created October 26, 2012 17:05
Two-dimensional array with dimensions determined at runtime
// Two-dimensional array with dimensions determined at runtime
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@rmartinho
rmartinho / sarray2d.h
Created October 26, 2012 17:04
Two-dimensional array with dimensions determined at compile-time
// Two-dimensional array with dimensions determined at compile-time
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@rmartinho
rmartinho / arrays.h
Last active October 12, 2015 02:48
Simple functions for better usage of arrays
// begin() and end() functions for arrays (C++03)
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@rmartinho
rmartinho / halcyon.md
Last active October 10, 2015 14:58
Halcyon

This document is an informal collection of design ideas for the Halcyon programming language. This document in in permanent draft status; do not take anything you read here as final. There are no plans to ever actually implement the ideas here; they're listed only for future reference.

Wants

  • Static, strong typing

    Type errors at runtime are stupid.

  • Type inference

@rmartinho
rmartinho / hate.markdown
Last active July 15, 2020 01:33
I will hate you

Dear C++ library writer,

  1. If your library forces me to use new all over, I will hate you.

  2. If your library has types with bogus values, I will hate you.

  3. If the documentation for your library gets the terminology of its own domain wrong, I will hate you.

  4. If I say "My God, it's full of stars!" when I see the function signatures in your library, I will hate you.

@rmartinho
rmartinho / gist:3174021
Created July 25, 2012 02:33
Example of gist.io bug with quotes and lists
> - This is a list item, in a quote!
> - This is another list item, in a quote!
@rmartinho
rmartinho / frontier-magic.md
Last active October 7, 2015 13:38
Beyond the Frontier Magic

The [Frontier Magic rules][wizards rules] created by Wizards are a good start but not as fun as we had expected. So we made up new rules based off of the same idea. These are those modified rules.

Terrain

TODO: more complete description of the terrain

Home row

The home row is a row between a player and the land cards.

@rmartinho
rmartinho / deprecated.md
Last active October 7, 2015 13:17
[[deprecated]] attribute proposal

Introduction

This documents describes a proposal for providing authors of C++ libraries with a standard facility to mark code entities as deprecated.

Motivation and Scope

Libraries change with time. Sometimes features are replaced by more powerful ones, or are found to be inherently flawed. A common way for library writers to deal with this problem is to recommend against such old features, i.e., to mark them as deprecated.

Right now there is no standard means of doing that. Library writers are thus forced to either simply document them as deprecated, or to use the preprocessor to decide upon one of the various compiler extensions that exist to support this feature.

@rmartinho
rmartinho / text-design.md
Last active October 7, 2015 12:38
Design ideas for ogonek::text

Motivation

ogonek::text is intended as a Unicode-based string class. Not as a glorified container of characters, like std::basic_string, but as an actual piece of Unicode text.

Storage

text is not about storage, so it delegates that to another container. That container can be customized, yielding a varied range of performance characteristics suitable to any situations. One could have a Unicode text array, similar to std::basic_string, or one could have a Unicode text deque, or even a rope.

Encoding