Skip to content

Instantly share code, notes, and snippets.

View xgalaxy's full-sized avatar

Robert D. Blanchet Jr. xgalaxy

View GitHub Profile
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active July 4, 2024 07:31
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@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().
@mohamed
mohamed / build-gn.sh
Last active September 23, 2022 06:25
Build Google gn build tool standalone
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# https://github.com/ninja-build/ninja
# https://gn.googlesource.com/gn/
# We need a recent git
@imneme
imneme / randutils.hpp
Last active April 16, 2025 13:48
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Melissa E. O'Neill
*
@t-mat
t-mat / vs14-ctp3-constexpr.cpp
Created August 19, 2014 09:14
Visual Studio 14 CTP 3 : C++11 constexpr testing
// (1) In VS14 CTP3, implementation of constexpr is still partial.
// http://blogs.msdn.com/b/vcblog/archive/2014/06/11/c-11-14-feature-tables-for-visual-studio-14-ctp1.aspx
//
#include <stdio.h>
#include <stdint.h>
// (2) Straightforward FOURCC
constexpr uint32_t fourcc(const char* p) {
return (static_cast<uint32_t>(p[0]) << (8*0))
@zokier
zokier / bitmatch.rs
Created August 11, 2014 18:37
Rust bitlevel pattern matching
#![feature(plugin_registrar)]
extern crate syntax;
extern crate rustc;
use syntax::ast;
use syntax::codemap::Span;
use syntax::ext::base;
use syntax::ext::base::{ExtCtxt, MacExpr};
use syntax::ext::build::AstBuilder;
use syntax::parse::token;