Skip to content

Instantly share code, notes, and snippets.

View Sam-Spencer's full-sized avatar
🦘
codin'

Sam Spencer Sam-Spencer

🦘
codin'
View GitHub Profile
@kieranb662
kieranb662 / CollapsibleGridLines.swift
Created July 24, 2021 00:46
Animated Grid that can collapse from any number of rows and columns to a 2x2 square. Made With SwiftUI.
// Swift toolchain version 5.0
// Running macOS version 12.0
// Created on 6/24/21.
//
// Author: Kieran Brown
//
import SwiftUI
struct CollapsibleGridLines: View {
@joemasilotti
joemasilotti / Multiple sheets in SwiftUI.md
Last active October 13, 2021 03:20
Multiple sheets in SwiftUI
/**
This sample code is available under the MIT license.
*/
@available(iOS 12.0, *)
public final class ShortcutManager {
/**
This enum specifies the different intents available in our app and their various properties for the `INIntent`.
Replace this with your own shortcuts.
//
// Copyright (c) 2016, 2018 Nikolai Ruhe. All rights reserved.
//
import Foundation
public extension FileManager {
/// Calculate the allocated size of a directory and all its contents on the volume.
@mayankk2308
mayankk2308 / boost-low-pri-macOS.sh
Created July 17, 2018 17:35
Boost Low-Priority Tasks on macOS
# Useful for improving Time Machine backup prep. times, Mac App Store install speeds, etc.
sudo sysctl debug.lowpri_throttle_enabled=0
# To restore defaults
sudo sysctl debug.lowpri_throttle_enabled=1
@shaps80
shaps80 / 1. UserDefaults+Key.swift
Last active September 25, 2020 08:29
Adds a Swift extension to make UserDefaults more consistent to work with.
//
// UserDefaults.swift
//
// Created by Shaps Benkau on 24/05/2018.
// Copyright © 2018 152percent Ltd. All rights reserved.
//
import Foundation
#if os(iOS)
@JaviLorbada
JaviLorbada / CustomFontPlayground.swift
Created August 31, 2015 19:09
Load custom fonts within Swift playgrounds
//: Playground - noun: a place where people can play
import UIKit
let fontURL = NSBundle.mainBundle().URLForResource("PillGothic300mg-bold", withExtension: "ttf")
CTFontManagerRegisterFontsForURL(fontURL!, CTFontManagerScope.Process, nil)
var pillGothicFontBold = UIFont(name: "PillGothic300mg-bold", size: 30)
var attrs = [NSFontAttributeName : pillGothicFontBold!,
@dokun1
dokun1 / UILabel with Countdown
Last active February 27, 2017 17:00
UILabel as countdown timer given NSTimeInterval
-(void) updateCountdown {
NSTimeInterval timeToClosing = [_deleteDate timeIntervalSinceDate:[NSDate date]];
div_t h = div(timeToClosing, 3600);
int hours = h.quot;
div_t m = div(h.rem, 60);
int minutes = m.quot;
int seconds = m.rem;
NSString *hoursStr, *minutesStr, *secondsStr;