Skip to content

Instantly share code, notes, and snippets.

View mntone's full-sized avatar
🏠

monotone mntone

🏠
View GitHub Profile
@MangaD
MangaD / cmake_build_types.md
Created February 16, 2025 19:55
Comprehensive Guide to `Release`, `Debug`, `RelWithDebInfo`, and `MinSizeRel` Build Types in CMake

Comprehensive Guide to Release, Debug, RelWithDebInfo, and MinSizeRel Build Types in CMake

CC0

Disclaimer: ChatGPT generated document.

In C++ development, build configurations affect performance, debugging capabilities, and binary size. CMake provides four standard build types:

  1. Debug – Full debugging symbols, no optimizations.
  2. Release – Maximum optimizations, no debugging symbols.
@ConnerWill
ConnerWill / ANSI-escape-sequences.md
Last active December 19, 2025 15:30
ANSI Escape Sequences cheatsheet

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@robotdad
robotdad / vs_cpp_winget.md
Last active November 26, 2025 07:11
Installing VS C++ workloads with winget

This is a short outline of how to install the C++ workload with Visual Studio or the build tools using winget.

To find VS releases with winget use search. winget search buildtools

The install command will install the VS installer with the core of the selected product installed. That isn't much. So if you use either of these commands to insll VS or the build tools you will need to launch the VS installer afterwards and select the relevant C++ workloads you need.

winget install Microsoft.VisualStudio.2022.BuildTools

winget install Microsoft.VisualStudio.2022.Community
import SwiftUI
struct ContentView: View {
@State var path: [String] = []
func navigationButton(value: String) -> some View {
NavigationButton {
path.append(value)
} label: {
Text("NavigationButton")
@yakushevichsv
yakushevichsv / UnfairLock.swift
Created September 5, 2021 08:53
os_unfair_lock_t instead of NS{Recursive}Lock
// MARK: - UnfairLock
final class UnfairLock {
private let unfairLock: os_unfair_lock_t //UnsafeMutablePointer<os_unfair_lock>
private let unfairValue: os_unfair_lock_s
init() {
unfairLock = .allocate(capacity: 1)
unfairValue = .init()
unfairLock.initialize(to: unfairValue)
}
class FloatingPanel: NSPanel {
init(contentRect: NSRect, backing: NSWindow.BackingStoreType, defer flag: Bool) {
// Not sure if .titled does affect anything here. Kept it because I think it might help with accessibility but I did not test that.
super.init(contentRect: contentRect, styleMask: [.nonactivatingPanel, .resizable, .closable, .fullSizeContentView], backing: backing, defer: flag)
// Set this if you want the panel to remember its size/position
// self.setFrameAutosaveName("a unique name")
// Allow the pannel to be on top of almost all other windows
@YusukeHosonuma
YusukeHosonuma / Example.swift
Created August 15, 2020 02:07
NWPathMonitor を Combine の Publisher として扱えるようにする拡張
import SwiftUI
import Network
final class ViewModel: ObservableObject {
@Published var status: NWPath.Status = .satisfied
init() {
NWPathMonitor()
.publisher()
.map { $0.status }
@Dev1an
Dev1an / CGPoint+SIMD.swift
Created August 8, 2020 10:32
SIMD extensions for CGPoint and CGSize
import struct CoreGraphics.CGSize
import struct CoreGraphics.CGPoint
import struct CoreGraphics.CGFloat
extension CGSize: SIMD {
public typealias MaskStorage = SIMD2<CGFloat.NativeType.SIMDMaskScalar>
public subscript(index: Int) -> CGFloat {
get {
index == 0 ? width : height
@creaaa
creaaa / Controlling Publishing with Connectable Publishers
Last active October 20, 2021 02:21
share、makeConnectable、connect
share() を消すとどうなるか?
=> 購読が1本ではなく、2本発生するので、1も2も両方 valueとfinished を無事受け取れる。
Received data 1: 1256 bytes.
Received completion 1: finished.
Received data 2: 1256 bytes.
Received completion 2: finished.
これだとPublisherの生成コストがエコではないから、share()を使ってPublisherを struct => class化し、
@takoikatakotako
takoikatakotako / ContentView.swift
Created April 30, 2020 10:33
SwiftUI で文字列中にタップ可能なリンクを追加する
import SwiftUI
struct ContentView: View {
var body: some View {
AttributedText(getAttributeString())
}
func getAttributeString() -> NSAttributedString {
let baseString = """