Skip to content

Instantly share code, notes, and snippets.

@mikemahony
mikemahony / unsubmodule.md
Last active July 3, 2025 18:47 — forked from dansuh17/unsubmodule.md
Convert git submodule to regular directory

From Stack Overflow.

# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin

# Start a fake merge (won't change any files, won't commit anything)
git merge -s ours --no-commit --allow-unrelated-histories submodule_origin/master
@mikemahony
mikemahony / SemanticVersionNumber.swift
Last active August 1, 2024 05:59 — forked from mjdescy/SemanticVersionNumber.swift
Semantic Version Number struct (Swift 4.1)
import Foundation
public struct SemanticVersionNumber: Equatable {
public let major: Int
public let minor: Int
public let patch: Int
public init?(version: String) {
let components = version.split(separator: ".")
guard components.count == 3 else { return nil }

External Interface Sample Code

@mikemahony
mikemahony / AddArgs.txt
Last active December 7, 2016 23:24
Fun, nerdy coding problems!
Add all the numbers passed into a function.
Examples:
>>> add(2, 2)
4
>>> add(46, 643, 2, 78)
769