Skip to content

Instantly share code, notes, and snippets.

name = "solarized-dark";
Back = 0xFF002b36;
Margin = 0xFF073642;
Margin_Hover = 0xFF002b36;
Margin_Active = 0xFF002b36;
List_Item = Margin;
List_Item_Hover = 0xFF6c71c4;
List_Item_Active = 0xFFd33682;
Cursor = 0xFF93a1a1;
@croepha
croepha / sdk_kb_mash_test.cpp
Last active February 1, 2018 07:06
sdk_kb_mash_test.cpp
#include <stdio.h>
#include <assert.h>
//#include <SDL.h>
#include <SDL2/SDL.h>
bool keys_hit[512] = {};
SDL_Keycode __small_keysym_to_sdl_keysym(int smks) {
SDL_Keycode ret = 0;
@croepha
croepha / cubic_ease.cpp
Last active January 10, 2018 17:28
cubic_ease.cpp
float cubic_ease(float p1x, float p1y, float t, float p2x, float p2y) {
if (t>=1) return 1;
if (t<=0) return 0;
static const double epsilon = 1e-7;
auto cx_ = 3.0 * p1x;
auto bx_ = 3.0 * (p2x - p1x) - cx_;
LD.LLD(1) User Commands LD.LLD(1)
NAME
ld.lld - manual page for ld.lld 5.0
DESCRIPTION
OVERVIEW: lld
USAGE: build-llvm/bin/ld.lld [options] <inputs>
/*
Example output:
proc:
Got opt1
proc:
Got opt1
Got opt3
proc:
void paint_text(V2<float>&cursor, V4<float>&bounds, BakedFont&font, char*input_text) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, font.texture);
glBegin(GL_QUADS);
char*text_end = strlen(input_text) + input_text;
for(char*t = input_text; t<text_end; t++) {
if (*t == '\n') {
cursor.x = bounds.l;
cursor.y += font.size;
} else if (*t >= 32) {
// Example of how to watch files on BSD/OSX, with a timer thrown in for fun
#define MAIN_WATCH "file1"
#define ALTERNATING_WATCH "file2"
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/event.h>
// clang++ -Wno-writable-strings pty_reader.cpp -lutil -o pty_reader
#include <stdio.h>
#include <unistd.h>
#include <pty.h>
int main(){
fprintf(stdout, "READER...\n");
fflush(stdout);
int master = 0;
@croepha
croepha / compile_time_tests.cpp
Last active October 2, 2017 15:33
compile_time_tests.cpp
/* build.sh:
mkdir -p build/
time clang++ --std=gnu++11 \
-fsanitize=address -fsanitize=undefined \
main.cpp -o build/main.bin
build/main.bin
echo building build/output.c
wc build/output.c
echo gcc
env time gcc -c build/output.c -o build/output.c.o
@croepha
croepha / crap_gotos.cpp
Created September 14, 2017 08:51
crap_gotos.cpp
char c;
#define _E(m_l) { printf("get_search_result_file_and_line failed at %d\n", __LINE__); goto m_l; } ;
c = read_char();
if(c == '\n') _E(line_ended);
if(c != 'L') _E(ignore_rest);
c = read_char();
if(c == '\n') _E(line_ended);
if(c != 'i') _E(ignore_rest);