Skip to content

Instantly share code, notes, and snippets.

View Megatron1000's full-sized avatar

Mark Bridges Megatron1000

View GitHub Profile
@Megatron1000
Megatron1000 / LogReportCreator.swift
Created April 29, 2022 21:22
Export OSLog To File
import Foundation
import OSLog
@available(iOS 15.0, *)
final class LogReportCreator {
enum LogReportCreatorError: Error {
case noEntries
case unableToFindCachesDirectory
case unknownError(error: Error)
@Megatron1000
Megatron1000 / KeyboardLayoutGuide.swift
Last active August 20, 2020 14:45 — forked from myell0w/KeyboardLayoutGuide.swift
A UILayoutGuide that follows the Keyboard on iOS
import Foundation
import UIKit
/// Used to create a layout guide that pins to the top of the keyboard
final class KeyboardLayoutGuide {
private let notificationCenter: NotificationCenter
private let bottomConstraint: NSLayoutConstraint
@Megatron1000
Megatron1000 / gist:e504bee399ce5317b4d43494c0f2d0a8
Created November 13, 2016 16:46
Delete all nsuserdefaults data for a macOS app, via terminal
defaults delete com.bundle.identifier
@Megatron1000
Megatron1000 / Create Mac Icons
Last active December 28, 2015 13:19
This is a Photoshop script which, given a 1024x1024 image, will produce correctly named and resized image files for mac application icons. This is largely taken from Matt Di Pasquale's iPhone app icon resizing script
// Photoshop Script to Create Mac Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@Megatron1000
Megatron1000 / NSString+ArrayWriter.h
Created October 15, 2013 19:49
Category for NSString that can turn an array of strings into a list with comas and an and at the end.
//
// NSString+ArrayWriter.h
// Attributed String Creator
//
// Created by Mark Bridges on 15/10/2013.
// Copyright (c) 2013 Mark Bridges. All rights reserved.
//
#import <Foundation/Foundation.h>
@Megatron1000
Megatron1000 / 0_reuse_code.js
Created October 15, 2013 08:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console