Skip to content

Instantly share code, notes, and snippets.

@AppleBetas
AppleBetas / Colour.swift
Last active July 10, 2016 03:33
Colour.swift - A great way to add quick colours to command-line Swift apps with a quick and easy API
//
// Colour.swift
//
// Created by AppleBetas on 2016-07-09.
// Copyright © 2016 AppleBetas. All rights reserved.
//
/*
Example usage:
@AppleBetas
AppleBetas / UIViewController+QuickAlert.swift
Last active January 15, 2017 06:43
UIViewController+QuickAlert.swift - A UIViewController extension to quickly show alerts
//
// UIViewController+QuickAlert.swift
//
// Created by AppleBetas on 2016-09-11.
// Copyright © 2016 AppleBetas. All rights reserved.
//
import UIKit
extension UIViewController {
@AppleBetas
AppleBetas / UIAlertAction+Image.swift
Created September 11, 2016 17:17
UIAlertAction+Image.swift - An easier way to add images to UIAlertActions (alerts and action sheets)
//
// UIAlertAction+Image.swift
//
// Created by AppleBetas on 2016-09-11.
// Copyright © 2016 AppleBetas. All rights reserved.
//
import UIKit
extension UIAlertAction {

Keybase proof

I hereby claim:

  • I am AppleBetas on github.
  • I am applebetas (https://keybase.io/applebetas) on keybase.
  • I have a public key whose fingerprint is 84DC 84E8 169F 6DB6 E7B3 03D5 CD41 B403 E6E0 7E2E

To claim this, I am signing this object:

@AppleBetas
AppleBetas / Remove transparency.sh
Last active October 24, 2016 04:12
Remove transparency.sh - A quick command to remove transparency from images in a directory with ImageMagick
# Remove alpha channel and replace with black
mogrify -background black -alpha remove -alpha off *.png
# Check alpha channel of images in directory (requires Xcode and command-line tools; not required)
sips -g hasAlpha *.png
@AppleBetas
AppleBetas / Device.swift
Last active April 13, 2019 19:06
Device.swift - Cross-platform class for device model and model identifier information
//
// Device.swift
//
// Created by AppleBetas on 2015-12-30.
// Copyright © 2015 AppleBetas. All rights reserved.
//
import Foundation
class Device {
@AppleBetas
AppleBetas / NSAlert+QuickAlert.swift
Last active February 7, 2019 23:11
NSAlert+QuickAlert.swift - A Swift NSAlert extension to quickly show alerts (macOS)
//
// NSAlert+QuickAlert.swift
//
// Created by AppleBetas on 2016-10-24.
// Copyright © 2016 AppleBetas. All rights reserved.
//
import Cocoa
extension NSAlert {
@AppleBetas
AppleBetas / Randoms.swift
Created November 19, 2016 21:05
Randoms.swift - Random helper methods for Int, Double, Float, Dictionaries, and Arrays
//
// Randoms.swift
//
// Created by AppleBetas on 2016-02-21.
// Copyright © 2016 AppleBetas. All rights reserved.
//
import Foundation
extension Array {
@AppleBetas
AppleBetas / Netflix PIP Bookmarklet.js
Last active July 6, 2018 16:00
Netflix PIP Bookmarklet - Paste this into a Safari bookmarklet, and enjoy PIP Netflix!
// NETFLIX PIP BOOKMARKLET
// Paste the following into a bookmarklet, and from the Safari Develop menu, check "Allow JavaScript from Smart Search Field". Whenever you open this bookmarklet with a Netflix video playing, it will pop into Picture in Picture.
// Some accounts have different UIs for some reason so use the one that matches yours
// New UI:
javascript:document.querySelector(".NFPlayer > .video-container > div > video").webkitSetPresentationMode("picture-in-picture");
// Old UI:
javascript:document.querySelector(".player-video-wrapper video").webkitSetPresentationMode("picture-in-picture");
@AppleBetas
AppleBetas / WatchInfo.swift
Last active February 24, 2023 05:51
WatchInfo.swift - Quickly get connected Apple Watch and installed Watch app state
//
// WatchInfo.swift
//
// Created by AppleBetas on 2016-12-10.
// Copyright © 2016 AppleBetas. All rights reserved.
//
import Foundation
import WatchConnectivity