Skip to content

Instantly share code, notes, and snippets.

View meshula's full-sized avatar
💭
Exploring liminal spaces

Nick Porcino meshula

💭
Exploring liminal spaces
View GitHub Profile
@meshula
meshula / OSKit.swift
Created January 30, 2023 20:14 — forked from nicklockwood/OSKit.swift
A lightweight approach to writing cross-platform code in SwiftUI without a lot of conditional compilation blocks
import SwiftUI
enum OSDocumentError: Error {
case unknownFileFormat
}
#if canImport(UIKit)
import UIKit
@meshula
meshula / README.md
Created December 13, 2021 05:31 — forked from pfgithub/CALLOC.md
wrapper to use a zig allocator in c code

usage

export allocation functinos from zig

comptime {
    @import("calloc").wrapAllocator(struct {
        pub fn getAllocator() std.mem.Allocator {
            return …;
 }
@meshula
meshula / dinput8_joystick.cpp
Created May 16, 2021 19:28 — forked from t-mat/dinput8_joystick.cpp
DirectInput Joystick class
#include <windows.h>
#include <stdio.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
class DiJoyStick {
public:
#include <iostream>
#include <assert.h>
#include <vector>
template<class T>
struct Func{};
// std::func replacement without dynamic memory allocation (captures are limited to 48 bytes)
// this could be extended to support captures >48 bytes... of course, with a bit more of logic
// and some state.
@meshula
meshula / clean_git_repository.bash
Created January 15, 2021 22:54 — forked from ymollard/clean_git_repository.bash
Clean a git repository by deleting history and data of old deleted files
#!/bin/bash
# This script, executed at the root of a git repository, deletes traces of every old file in this repository, index + blob on all branches
# It can take 10-30 minutes to run and will print regular warning stating than some references are unchanged
# time ./clear_git_repositor.bash >cleaning.log
# We need several passes to clean files renamed multiple times (git log --find-renames prevents its deletion for each renaming)
# MAXIMUM_PASSES should be more than the maximum number of renamings/movings for any file, if not then we might keep some traces of former files
MAXIMUM_PASSES=10 # Maximum number of passes
@meshula
meshula / install_tmux_macos_no_brew.sh
Created February 12, 2020 19:19 — forked from dxps/install_tmux_macos_no_brew.sh
Install TMUX on MacOS without Brew
#!/bin/sh
## setup _________________________________
TMUX_VER=2.9a
LIBEVENT_VER=2.1.11-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux
@meshula
meshula / install_tmux_macos_no_brew.sh
Created February 12, 2020 19:19 — forked from dxps/install_tmux_macos_no_brew.sh
Install TMUX on MacOS without Brew
#!/bin/sh
## setup _________________________________
TMUX_VER=2.9a
LIBEVENT_VER=2.1.11-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux
#pragma once
/*
// Example use on Windows with links opening in a browser
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "Shellapi.h"
inline void LinkCallback( const char* link_, uint32_t linkLength_ )
@meshula
meshula / NodeGraph.cpp
Created December 13, 2018 21:09 — forked from spacechase0/NodeGraph.cpp
ImGui node graph
#include <any>
#include <cmath>
#include <imgui.h>
#include <imgui_internal.h>
#include "NodeGraph.hpp"
namespace
{
@meshula
meshula / ImguiMayaStyle.cpp
Created December 11, 2017 18:51 — forked from ongamex/ImguiMayaStyle.cpp
ImGui style that look like Maya
ImGuiStyle& style = ImGui::GetStyle();
style.ChildWindowRounding = 3.f;
style.GrabRounding = 0.f;
style.WindowRounding = 0.f;
style.ScrollbarRounding = 3.f;
style.FrameRounding = 3.f;
style.WindowTitleAlign = ImVec2(0.5f,0.5f);
style.Colors[ImGuiCol_Text] = ImVec4(0.73f, 0.73f, 0.73f, 1.00f);