Skip to content

Instantly share code, notes, and snippets.

View BeRo1985's full-sized avatar

Benjamin Rosseaux BeRo1985

View GitHub Profile
@BeRo1985
BeRo1985 / minifycss.pas
Created December 23, 2017 12:28
ObjectPascal simple but fast and efficient CSS minifier
function MinifyCSS(const aInput:ansistring):ansistring;
var Position,Len,TemporaryPosition:longint;
TemporaryInput:string;
begin
Position:=1;
Len:=length(aInput);
TemporaryInput:='';
while Position<=Len do begin
if ((Position+2)<=Len) and ((aInput[Position]='/') and (aInput[Position+1]='*')) then begin
inc(Position,2);
@BeRo1985
BeRo1985 / qtangent_quaternion.glsl
Last active October 18, 2017 10:14
GLSL QTangent and Quaternion code stuff
// Copyright (C) 2017, Benjamin 'BeRo' Rosseaux - benjamin@rosseaux.de
// License: CC0
vec4 matrixToQTangent(mat3 m){
float f = 1.0;
if(((((((m[0][0]*m[1][1]*m[2][2])+
(m[0][1]*m[1][2]*m[2][0])
)+
(m[0][2]*m[1][0]*m[2][1])
)-
@BeRo1985
BeRo1985 / fragment.glsl
Last active December 22, 2016 14:55
Intel GLSL function-inlining compiler bug testcase
///////// Fragment shader: //////////
#version 430
in vec2 vTexCoord;
uniform vec2 resolution; // the canvas resolution size
layout(location = 0) out vec4 oColor;
#if 1
float opUnion(const in float d1, const in float d2){
@BeRo1985
BeRo1985 / keybase.md
Created July 5, 2016 14:08
keybase.md

Keybase proof

I hereby claim:

  • I am BeRo1985 on github.
  • I am bero (https://keybase.io/bero) on keybase.
  • I have a public key whose fingerprint is 82D7 1927 94C1 94CB F680 8627 DDA2 6B2E 4E80 9446

To claim this, I am signing this object:

@BeRo1985
BeRo1985 / _results.txt
Last active June 12, 2016 16:26
POCA vs Lua benchmark
d:\Projects\POCA\trunk\src>lua53.exe primes.lua
time: 0.18200000 seconds, primes: 17984.000000
time: 54.92000000 seconds, primes: 17984.000000
time: 50.26400000 seconds, primes: 17984.000000
d:\Projects\POCA\trunk\src>pocarun primes.poca
time: 0.032 seconds, primes: 17984
time: 14.741 seconds, primes: 17984
time: 13.948 seconds, primes: 17984
@BeRo1985
BeRo1985 / ClassIDTest1.pas
Created June 7, 2016 08:34
Enity-Component-System ComponentClassID per VMT patching
program ClassIDTest1;
{$mode delphi}
{$apptype console}
{$m+}
uses Windows,SysUtils,Classes;
type PSupraComponentClassNameID=^TSupraComponentClassNameID;
TSupraComponentClassNameID=record
Name:shortstring;
@BeRo1985
BeRo1985 / FLREBenchmarkResults.txt
Created February 5, 2016 08:23
New FLRE benchmark values of 05. Feburary 2015
==============================================
New FLRE benchmark values of 05. Feburary 2015
==============================================
In summary:
Delphi's 32-bit x86 code generator is better than FreePascal's 32-bit x86 code generator,
and FreePascal's 64-bit x86 code generator is better than Delphi's 64-bit x86 code
generator. The x86 inline assembler routines falls not so significant yet, i.e.
@BeRo1985
BeRo1985 / ringbuffer.c
Last active November 27, 2015 16:28
Lock Free Single Producer Single Consumer Ring Buffer
// Copyright (C) 2015 by Benjamin 'BeRo' Rosseaux
// licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication ( http://creativecommons.org/publicdomain/zero/1.0/ )
// Warning: Untested, written from scratch directly as a GitHubGist. It should only show the base idea behind it.
#define RingBufferInt int
#define RingBufferAtomicInt int
typedef int TRingBufferItem;
@BeRo1985
BeRo1985 / nrook_antialiasing.glsl
Last active March 17, 2017 02:55
GLSL n-rook anti-aliasing - based on the idea from http://mlab.uiah.fi/~kkallio/antialiasing/EdgeFlagAA.pdf
// n-rook anti-aliasing - based on the idea from http://mlab.uiah.fi/~kkallio/antialiasing/
// GLSL implementation by Benjamin 'BeRo' Rosseaux
// licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication ( http://creativecommons.org/publicdomain/zero/1.0/ )
#version 150
#define nrookSamples 8
uniform vec2 resolution;
vec4 realMainContent(vec2 p){
vec4 c = vec4(0.);
// ...
return c;
@BeRo1985
BeRo1985 / GDFWENet.pas
Last active September 26, 2015 06:04
enet pascal port with IPv6 support
(*
**
** Copyright (c) 2002-2015 Lee Salzman
** Copyright (c) 2013-2015 Benjamin 'BeRo' Rosseaux (Pascal port and IPv6)
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
** to deal in the Software without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Software, and to permit persons to whom the