Skip to content

Instantly share code, notes, and snippets.

View Namek's full-sized avatar
💻

Kamil Dąbrowski Namek

💻
View GitHub Profile
//! Shows how to manually convert a group of enums / ints into a packed struct and then into an integer
//! which can be used in a switch statement. Useful for eliminting complicated nested switches / ifs.
//!
//! Then creates helpers switchable() and switchableAny() for doing the same.
//!
//! Note: the second part only works with stage1 as of 9/25/22 (zig version
//! 0.10.0-dev.4115+75e9a8c7f). stage2 currently crashes on this but will likely work soon.
const std = @import("std");
@davidfowl
davidfowl / MinimalAPIs.md
Last active June 28, 2024 17:42
Minimal APIs at a glance
@moebiussurfing
moebiussurfing / dock_builder_example.cpp
Created July 29, 2021 03:36 — forked from PossiblyAShrub/dock_builder_example.cpp
Simple example, of how to use the dock builder API. (Adapted from the dock space example in the demo window) You need to use the docking branch and set the ImGuiConfigFlags_DockingEnable config flag. Learn more about Dear ImGui here: https://github.com/ocornut/imgui
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
ImGui::SetNextWindowSize(viewport->Size);
ImGui::SetNextWindowViewport(viewport->ID);
// Test helper for imgui_freetype
#include "misc/freetype/imgui_freetype.h"
struct FreeTypeTest
{
enum FontBuildMode { FontBuildMode_FreeType, FontBuildMode_Stb };
FontBuildMode BuildMode = FontBuildMode_FreeType;
bool WantRebuild = true;
@raysan5
raysan5 / custom_game_engines_small_study.md
Last active July 13, 2024 23:25
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@gdotdesign
gdotdesign / WebSocket.mint
Last active March 19, 2020 21:38
WebSocket in Mint
record Provider.WebSocket.Subscription {
onOpen : Function(WebSocket, Promise(Never, Void)),
onMessage : Function(String, Promise(Never, Void)),
onError : Function(Promise(Never, Void)),
onClose : Function(Promise(Never, Void)),
url : String
}
provider Provider.WebSocket : Provider.WebSocket.Subscription {
fun open (url : String, socket : WebSocket) : Array(a) {
@brunocascio
brunocascio / reset-knex-seq.js
Last active July 4, 2020 13:06
Reset all tables sequence values in postgres with knex
return await knex.transaction(async t => {
try {
// Retrieve table names (excluding migrations_lock)
const tables = (await knex
.raw(`
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public'
`)
.transacting(t)
)
const R = 6371; // earths radius in km
function radiansFromDegrees(deg) {
return deg * (Math.PI / 180);
}
// reduce number of positions using the Ramer–Douglas–Peucker algorithm
// https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
// Code based on: https://www.namekdev.net/2014/06/iterative-version-of-ramer-douglas-peucker-line-simplification-algorithm/
function simplifyGeoCoordinates(positions, tolerance) {
@btroncone
btroncone / rxjs_operators_by_example.md
Last active June 15, 2024 07:17
RxJS 5 Operators By Example
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter