Skip to content

Instantly share code, notes, and snippets.

@STCollier
STCollier / flappy-golf.c
Created January 30, 2025 16:04
Flappy Bird in OpenGL & C (2456 bytes). SPACE to flap
#import<glad/glad.h>
#import<GLFW/glfw3.h>
#define d(a,p,x,y,w,h)glBindVertexArray(a);glUniform2f(glGetUniformLocation(p,"x"),w,h);glUniform2f(glGetUniformLocation(p,"y"),x,y);glDrawArrays(4,0,6);
a,b,c,d,e,g,s,x,y,z[]={1,1,1,1,1,-1,1,0,-1,1,0,1,1,-1,1,0,-1,-1,0,0,-1,1,0,1};main(){char*v="#version 330 core\nlayout(location=0)in vec2 p;layout(location=1)in vec2 a;uniform vec2 x;uniform vec2 y;out vec2 t;void main(){gl_Position=vec4(p*x+y,0,1);t=a;}\0",*f="#version 330 core\nout vec4 f;in vec2 t;uniform sampler2D i;void main(){f=texture(i,t);}\0";glfwInit();glfwWindowHint(139266,3);glfwWindowHint(139267,3);glfwWindowHint(139272,204801);int i,o=3553,q=34962,u=16,_=6407;GLFWwindow*w=glfwCreateWindow(800,800,"Flappy Bird",0,0);glfwMakeContextCurrent(w);gladLoadGLLoader(glfwGetProcAddress);c=glCreateShader(35633);glShaderSource(c,1,&v,0);glCompileShader(c);d=glCreateShader(35632);glShaderSource(d,1,&f,0);glCompileShader(d);s=glCreateProgram();glAttachShader(s,c);glAttachShader(s,d);glLinkProgram(s);glGenVertexArray
#include <stdio.h>
#include <stdint.h>
typedef struct {
uint8_t r, g, b;
} color_t;
uint16_t numbers[10] = {0xF6DE, 0xC92E, 0xE7CE, 0xE79E, 0xB792, 0xF39E, 0xF3DE, 0xE492, 0xF7DE, 0xF79E};
void putp(color_t color) {
@STCollier
STCollier / main.c
Created May 2, 2023 00:58
Golfed code that converts a 10 digit number to a phone number. e.g., 1234567890 -> (123) 456-7890
main(){char s[10];scanf("%[^\n]",s);printf("(%.*s) %.*s-%.*s",3,s,3,s+3,4,s+6);}