Skip to content

Instantly share code, notes, and snippets.

Avatar
🦋

Eric Scrivner etscrivner

🦋
View GitHub Profile
@etscrivner
etscrivner / picture-language.rkt
Created May 27, 2015
Complete racket source code for playing with the SICP picture language.
View picture-language.rkt
#lang racket/gui
(require graphics/graphics)
(open-graphics)
(define vp (open-viewport "A Picture Language" 500 500))
(define draw (draw-viewport vp))
(define (clear) ((clear-viewport vp)))
(define line (draw-line vp))
(define (make-vect x y)
@etscrivner
etscrivner / tea-timer.el
Created Jun 9, 2020
Tea steep timer. Blinks the modeline bar red when the tea is done steeping.
View tea-timer.el
;;
;; Simple timer that will blink the mode-line bar.
;;
;; Example Usage:
;;
;; Set a timer for 5 secs from now:
;;
;; (blink-bar-after-timer "5 sec")
;;
;; Set a timer for when tea has steeped after 3 mins:
View emacs_command_map.h
#if !defined(EMACS_COMMAND_MAP_H)
#define EMACS_COMMAND_MAP_H
// Create custom ID for our global emacs state data.
CUSTOM_ID(attachment, view_emacs_state_id);
CUSTOM_COMMAND_SIG(close_all_other_panels)
CUSTOM_DOC("Closes all other panels but the currently active one")
{
View_ID current_active_view_id = get_active_view(app, Access_Always);
@etscrivner
etscrivner / sha2.h
Created Feb 27, 2020
Single-header file SHA2 implementation from FreeBSD.
View sha2.h
/* $FreeBSD: src/sys/crypto/sha2/sha2.h,v 1.1.2.1 2001/07/03 11:01:36 ume Exp $ */
/* $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $ */
/*
* sha2.h
*
* Version 1.0.0beta1
*
* Written by Aaron D. Gifford <me@aarongifford.com>
*
View init.el
;;; init.el --- The emacs configuration entry-point
;;;
;;; Commentary:
;;; This is the first file executed when emacs is initialized.
;;;
;;; Code:
;; Determine our dotfiles directory
(defun get-dotfiles-directory ()
"Returns the directory the Emacs dotfiles are in."
View sdl_font_rendering.cc
#include <SDL.h>
#include "language_layer.h"
#include "memory_arena.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h"
#define WINDOW_WIDTH 1920
#define WINDOW_HEIGHT 1080
@etscrivner
etscrivner / Makefile
Last active Feb 15, 2020
Pixel-perfect 2D collision detection in SDL.
View Makefile
.PHONY: run
CXXFLAGS=-Wall -g -fno-exceptions -fno-rtti $(shell pkg-config sdl2 --cflags)
LDFLAGS=-lm $(shell pkg-config sdl2 --libs)
game: game.cc
$(CXX) $(CXXFLAGS) -o game game.cc $(LDFLAGS)
run: game
./game
@etscrivner
etscrivner / markdown.cc
Created Feb 4, 2020
Very basic markdown parser in C
View markdown.cc
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;
@etscrivner
etscrivner / markdown.cc
Created Feb 4, 2020
Very basic markdown parser in C
View markdown.cc
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;
@etscrivner
etscrivner / font_bake_sdf.cc
Created Feb 1, 2020
Bake SDF font bitmaps using stb libraries.
View font_bake_sdf.cc
#include <SDL.h>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <scaffold/types.h>
#include <scaffold/vec.h>
#include <scaffold/matrix.h>
#include <scaffold/gl.h>
You can’t perform that action at this time.