Skip to content

Instantly share code, notes, and snippets.

View veganaize's full-sized avatar

veganaiZe veganaize

View GitHub Profile
import java.util.concurrent.TimeUnit;
class InsertionSort {
public static void
main(String[] args) {
int[] unsortedArray = { 45, 12, 85, 32, 89, 39, 69, 44, 42, 1, 6, 8 };
int[] sortedArray = sort(unsortedArray);
displayArray(sortedArray, -1);
}
@veganaize
veganaize / snake-raylib-50.c
Created February 18, 2024 22:52
Snake; Raylib; 50 lines
#include "raylib.h"
int main() {
enum { TILE_SIZE=16, ROWS=30, COLS=20 };
int score = 0;
InitWindow(ROWS*TILE_SIZE, COLS*TILE_SIZE, "Snake");
SetTargetFPS(8);
struct { int row; int col; int h_velocity; int v_velocity; int length;
int body[ROWS][COLS]; }
@veganaize
veganaize / cpu-cache-ram.md
Created February 11, 2024 17:33
Programmer's Brain

image

@veganaize
veganaize / sdl2++.hpp
Created December 22, 2023 23:45
sdl2++
#ifndef PLUSPLUSSDL2_HPP_
#define PLUSPLUSSDL2_HPP_
#include <SDL2/SDL.h>
namespace sdl {
const Uint32 window_shown = SDL_WINDOW_SHOWN;
const int windowpos_undefined = SDL_WINDOWPOS_UNDEFINED;

If it ain't borked, don't fix it

image

There it was... Just sitting there, in all of its beauty. Nothing was wrong with it... Of course, until we contaminated it. It was a zero byte sized, empty file. It was perfect. We mistakenly thought it needed some improvement. So we filled it up with some source code.

It was actually the outside world that really needed the fixing. The idea was to bring in just enough of that (external) complexity into our program. Just enough so that we could straighten it out, a little. When we pull in too much of that chaos then the internal complexity (of our program) rises. If we reach such point then we will often resort to reliance on external tooling to solve our new found problems.

It's like we were trying to help someone out of a ditch and we ended up in there ourselves.

The problem here, in case you haven't noticed, is that we are deploying new t

@veganaize
veganaize / Game-Design.md
Last active March 29, 2024 21:05
Game / Design
@veganaize
veganaize / Icons.md
Last active April 11, 2024 21:29
Site, company, and product icons for use in github markdown.

- Acrobat
- Adobe PDF
- Android (classic)
- Android (modern)
- Apple (classic)
- Apple (modern)
- Arch

@veganaize
veganaize / unbuffered-wrap.c
Created June 27, 2021 23:33
Wrap words at column boundary
/* Only works with LF, not CRLF or CR
* Characters are presumed to be 7-bits.
* Tabs only count as one character.
*/
#include <stdio.h>
#include <ctype.h> /* isspace() */
#define COLUMNS 10
@veganaize
veganaize / TortillaTimer.java
Last active June 21, 2021 03:45
Kitchen timer for cooking foods
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class TortillaTimer {
static int mSeconds = -1;
static int mMinutes = -1;
static int mHours;
static String mName = "";