This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSExtension Dictionary | |
NSExtensionAttributes Dictionary | |
UNNotificationExtensionDefaultContent Number 0.5 | |
UNNotificationExtensionDefaultContentHidden Bool YES | |
UNNotificationExtensionCategory String event-invite | |
NSExtensionMainStoryboard String MainInterface | |
NSExtensionPointIdentifier String com.apple.usernotifications.content-extensio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UserNotifications | |
class ServiceExtension: UNNotificationServiceExtension | |
{ | |
struct Attachments { | |
static let image = (identifier:"image", jsonElement:"imageURL") | |
} | |
var contentHandler: ((UNNotificationContent) -> Void)? | |
var content: UNMutableNotificationContent? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler:(UNNotificationContent) -> Void) | |
{ | |
content = (request.content.mutableCopy() as? UNMutableNotificationContent) | |
content?.categoryIdentifier = "DylanOrDermotCategory" | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"aps": { | |
"alert": {...} | |
"mutable-content": 1 | |
} | |
"my-attachment": "https://foo.bar/baz.jpg", | |
"category": "DylanOrDermotCategory" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) | |
let request = UNNotificationRequest(identifier: "local_notification", content: content, trigger: trigger) | |
UNUserNotificationCenter.current().add(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let content = UNMutableNotificationContent() | |
content.title = "Will it rain?" | |
content.body = "It never rains in (Southern) California!" | |
content.sound = UNNotificationSound.default() | |
let url = URL(string: "https://67.media.tumblr.com/ab04c028a5244377a0ab96e73915e584/tumblr_nfn3ztLjxk1tq4of6o1_400.gif") | |
let attachment = try! UNNotificationAttachment(identifier: "image", url: url!, options: nil) | |
content.attachments = [attachment] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Mount the Installer image | |
hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app | |
# Create El Capitan sparseimage of 7316mb with a Single Partition - Apple Partition Map | |
hdiutil create -o /tmp/ElCapitan -size 7316m -layout SPUD -fs HFS+J -type SPARSE | |
# Mount the El Capitan sparseimage | |
hdiutil attach /tmp/ElCapitan.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.gui = true | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BASIC SWITCH | |
enum Media { case Book } | |
extension Media : CustomStringConvertible | |
{ | |
var description: String { | |
switch self { | |
case .Book: return "bible" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -a ! -name ".DS_Store" -exec shasum '{}' \; > shasums.txt | |
shasum -c < shasums.txt > check.txt | |
cat check.txt | fgrep -v OK |