Skip to content

Instantly share code, notes, and snippets.

View albertelwin's full-sized avatar

Albert Elwin albertelwin

View GitHub Profile
#ifndef MATH_HPP
#define MATH_HPP
#include <math.h>
#ifdef ASSERT
#define MATH_ASSERT(...) ASSERT(__VA_ARGS__)
#else
#define MATH_ASSERT(...)
{
"folders":
[
{
"path": "Assets",
"file_exclude_patterns": [
"*.dll",
"*.meta",
"*.mat",
"*.asset",
//NOTE: MSVC 2013 command line build
//cl -nologo -EHa- -Gm- -GR- -fp:fast -Oi -WX -W4 -wd4996 -wd4100 -wd4189 -wd4127 -wd4201 -wd4101 -wd4505 -MTd -Od -Z7 tear.cpp user32.lib gdi32.lib winmm.lib opengl32.lib -link -incremental:no -opt:ref
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#undef near
#undef far
stbtt_fontinfo ttf_info;
MemoryPtr ttf_file = read_file_to_memory(file_name);
ASSERT(ttf_file.ptr);
stbtt_InitFont(&ttf_info, ttf_file.ptr, stbtt_GetFontOffsetForIndex(ttf_file.ptr, 0));
f32 scale_factor = stbtt_ScaleForPixelHeight(&ttf_info, pixel_height);
i32 ascent, descent, line_gap;
stbtt_GetFontVMetrics(&ttf_info, &ascent, &descent, &line_gap);
[
{ "keys": ["alt+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["alt+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["alt+left"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["alt+right"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["alt+shift+left"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["alt+shift+right"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["ctrl+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false}},
@albertelwin
albertelwin / Max Consecutive Sum
Created October 11, 2013 16:01
Programming Interview Practice - Max Consecutive Sum - 11/10/13
/*
Programming Interview Practice - Max Consecutive Sum
Albert Elwin
Website: http://albertelw.in
Email: dev@albertelw.in
*/
#include <cstdio>