Skip to content

Instantly share code, notes, and snippets.

View tjklemz's full-sized avatar

Thomas Klemz tjklemz

View GitHub Profile
@muiz6
muiz6 / bitmap-example.cpp
Created June 27, 2020 12:05
Example code on how to write a bitmap file from scratch.
#include <cstdint> // for specific size integers
#include <fstream> // for file handling
using namespace std;
struct BmpHeader {
char bitmapSignatureBytes[2] = {'B', 'M'};
uint32_t sizeOfBitmapFile = 54 + 786432; // total size of bitmap file
uint32_t reservedBytes = 0;
uint32_t pixelDataOffset = 54;
} bmpHeader;
@Avaq
Avaq / combinators.js
Last active July 15, 2024 14:46
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@elirousso
elirousso / gist:3d5892eaa5d3b15dd901
Last active December 4, 2020 03:56
Dark Minimal Slack Theme
#Paste in Preferences > Sidebar Theme > Click thing at the bottom to expose the input and copy pasta this guy in there
#111111,#111111,#333333,#FFFFFF,#444444,#FFFFFF,#FFFFFF,#FF0000
@kakajika
kakajika / PathSimplifier.swift
Last active July 14, 2020 13:22
SwiftによるCGPathの曲線近似の実装(Inspired by paper.js)
// PathSimplifier.swift
import UIKit
private let TOLERANCE: CGFloat = 1e-6
private let EPSILON: CGFloat = 1e-12
extension CGPoint {
func add(p: CGPoint) -> CGPoint {
return CGPointMake(x+p.x, y+p.y)
@fogus
fogus / 0 - UNIX Fifth Edition
Created July 20, 2011 00:15
UNIX V5, OpenBSD, Plan 9, FreeBSD, and GNU coreutils implementations of echo.c
main(argc, argv)
int argc;
char *argv[];
{
int i;
argc--;
for(i=1; i<=argc; i++)
printf("%s%c", argv[i], i==argc? '\n': ' ');
}