Skip to content

Instantly share code, notes, and snippets.

View corybohon's full-sized avatar

Cory Bohon corybohon

View GitHub Profile

Keybase proof

I hereby claim:

  • I am corybohon on github.
  • I am corybohon (https://keybase.io/corybohon) on keybase.
  • I have a public key ASCYtIbFQwkvScE3Dmv9gLGKBw5dUa-50bHliQ_XxCbrHwo

To claim this, I am signing this object:

func addTodoItem(item: TodoItem) {
self.storedTodos.append(item)
self.createNotification(item.todoName, date: item.todoDueDate)
self.saveAndNotify()
}
func removeTodoItem(item: TodoItem) {
if self.storedTodos.contains(item) {
if let indexToRemove = self.storedTodos.indexOf(item) {
self.storedTodos.removeAtIndex(indexToRemove)
// Keyboard shortcuts
override func keyDown(theEvent: NSEvent) {
interpretKeyEvents([theEvent])
}
override func deleteBackward(sender: AnyObject?) {
let selectedRow: Int = self.tableView.selectedRow
if selectedRow == -1 {
return
}
//
// ViewController.swift
// Reminderz
//
// Created by Cory Bohon on 4/21/16.
// Copyright © 2016 MartianCraft. All rights reserved.
//
import Cocoa
//
// DataManager.swift
// Reminderz
//
// Created by Cory Bohon on 4/21/16.
// Copyright © 2016 MartianCraft. All rights reserved.
//
import Foundation
//
// TodoItem.swift
// Reminderz
//
// Created by Cory Bohon on 4/21/16.
// Copyright © 2016 MartianCraft. All rights reserved.
//
import Foundation
func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool {
return true
}
@corybohon
corybohon / gist:6471569
Created September 7, 2013 00:11
Using a nil NSDate log output error message.
*** -[__NSCFCalendar components:fromDate:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?
An exception has been avoided for now.
A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
(
)
@corybohon
corybohon / gist:5158471
Created March 14, 2013 02:56
Remove local and remote notifications in iOS apps. Simply put this in your App Delegate, and then call [self clearNotifications] in -didFinishLaunchingWithOptions, or another delegate method of your liking in your App Delegate. Personally, I like putting it in -- (void)applicationWillEnterForeground:(UIApplication *)application because that meth…
- (void) clearNotifications
{
[[UIApplication sharedApplication] cancelAllLocalNotifications];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
}