Skip to content

Instantly share code, notes, and snippets.

View eloraiby's full-sized avatar

Wael El Oraiby eloraiby

View GitHub Profile
@ifknot
ifknot / mcs_lock.h
Created January 1, 2018 00:50
MCS Lock
#ifndef MCS_LOCK_H
#define MCS_LOCK_H
#include <cstdint>
#include <assert.h>
#include <atomic>
#include <thread>
#include <iostream>
@ifknot
ifknot / cpu_relax.h
Created January 1, 2018 00:46
MCS Lock
#ifndef CPU_RELAX_H
#define CPU_RELAX_H
#include <intrin.h>
namespace sync {
inline static void cpu_relax() {
#if (COMPILER == MVCC)
// pie menu test
// v0.00
#include <imgui_internal.h>
// Return >= 0 on mouse release
// Optional int* p_selected display and update a currently selected item
int PiePopupSelectMenu(const ImVec2& center, const char* popup_id, const char** items, int items_count, int* p_selected)
{
int ret = -1;
@praeclarum
praeclarum / AlgorithmW.fs
Last active February 2, 2025 14:29
Algorithm W - or Hindley-Milner polymorphic type inference - in F#
module AlgorithmW
// HINDLEY-MILNER TYPE INFERENCE
// Based on http://catamorph.de/documents/AlgorithmW.pdf
// (Now at http://web.archive.org/web/20170704013532/http://catamorph.de/documents/AlgorithmW.pdf)
type Lit =
| LInt of int
| LBool of bool
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active March 6, 2025 16:51
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@ocornut
ocornut / (Archived) imgui_memory_editor.h
Last active August 28, 2024 05:01
Mini memory editor for dear imgui (to embed in your game/tools)
// Mini memory editor for Dear ImGui (to embed in your game/tools)
// Animated GIF: https://twitter.com/ocornut/status/894242704317530112
// THE MEMORY EDITOR CODE HAS MOVED TO GIT:
// https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor
// Click "Revisions" on the Gist to see old version.
@gafferongames
gafferongames / delta_compression.cpp
Last active February 8, 2025 21:46
Delta Compression
/*
Delta Compression by Glenn Fiedler.
This source code is placed in the public domain.
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/
*/
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
@chrisdone
chrisdone / typing.md
Last active March 22, 2025 09:05
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@stephanh42
stephanh42 / stddev.fs
Created October 29, 2014 19:24
Computing mean and population standard deviation in Forth.
\ Computing mean and population standard deviation in Forth.
\ Tested on Gforth 0.7.0
16 constant FRAC \ number of bits behind fixed-point
\ convert from/to fixed point representation
: s>fix FRAC lshift ;
: fix>s FRAC rshift ;
\ fixed-point arithmetic