Skip to content

Instantly share code, notes, and snippets.

@zeux
zeux / murmur.h
Last active March 20, 2021 23:05
MurMurHash finalizers as 32-bit integer/pointer hashers
uint32_t murmur2(uint32_t h)
{
h ^= h >> 13;
h *= 0x5bd1e995;
h ^= h >> 15;
return h;
}
uint32_t murmur3(uint32_t h)
@toomasv
toomasv / range.red
Last active June 19, 2021 14:41
Range function for multiple datatypes
Red [
Author: "Toomas Vooglaid"
Date: 26-11-2017
]
range: function [val1 val2 /step stp /limit /enbase ebase /debase dbase /unicode][
stp+?: none
stp: any [stp either any [percent? val1 percent? val2] [1%][1]]
if any [all [block? stp zero? stp/3] zero? stp] [return none]
case [
debase [
@jemmanuel
jemmanuel / reallocation.md
Created April 10, 2020 14:26
Optimal memory reallocation and the golden ratio

This is based on a neat little post that I saw on Simon Frankau‘s blog that I thought I’d provide a few more details on, as well as bringing it to a wider audience. Some higher-level data structures in object-oriented programming languages have dynamic memory allocation. This is used to create objects (usually things that behave like lists) that can grow and shrink as the program executes. When initializing a regular array in C or Java, you have to specify the size of the array on creation, for example with

int myArray[] = new int[10];
@luce80
luce80 / Red-vid-styles.red
Last active April 23, 2024 17:30
Some useful Red View/VID styles
Red []
;%numeric-spinner.red
;%area-plus.red
;%splitter.red
;%scrollable-panel.red
;%%multi-text-list.red
;%area-rt.red
;%spinner-panel.red
;%tipped-button.red