Skip to content

Instantly share code, notes, and snippets.

@leonmak
leonmak / Local Notifications - iOS Swift 3.md
Last active August 10, 2017 21:30
Local Notifications - iOS Swift 3

Local notifications

  1. ViewController
import UserNotifications
class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
 UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge], completionHandler: {didAllow, error in })
@leonmak
leonmak / FB Login IOS.md
Created August 10, 2017 21:26
FB Login on iOS - Swift 3
  1. Pod file
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'
  1. AppDelegate
@leonmak
leonmak / Firebase Remote Notifications - IOS Swift 3.md
Last active September 27, 2020 18:01
Firebase Remote Notifications - IOS Swift 3

Rough notes on Remote Notifications (i.e. sent from firebase server/ console > Notifications, not Local Notifications):

  1. New single page app - Select project -> Target capabilities -> Select ON for Background modes(check remote) and push notifications

  2. pod init

   pod 'Firebase/Core'
   pod 'Firebase/Messaging'

then pod install

@leonmak
leonmak / food-expired.json
Last active June 24, 2017 06:45
scrape all the bad food!
{"food":[{"freezer":"","name":"abruzzese sausage, dry - unopened package","pantry":"4-6 weeks","refrigerator":"6 months","shortName":"abruzzese sausage"},{"freezer":"1-2 months","name":"abruzzese sausage, dry - opened package","pantry":"","refrigerator":"2-3 weeks","shortName":"abruzzese sausage"},{"freezer":"","name":"alfalfa sprouts - fresh, raw","pantry":"","refrigerator":"2-3 days","shortName":"alfalfa sprouts"},{"freezer":"4-6 months","name":"alfredo sauce - homemade","pantry":"","refrigerator":"3-4 days","shortName":"alfredo sauce"},{"freezer":"","name":"allspice, ground, dried, commercially bottled or purchased in bulk - unopened or opened","pantry":"3-4 years","refrigerator":"","shortName":"allspice"},{"freezer":"","name":"allspice, whole, dried, commercially bottled or purchased in bulk - unopened or opened","pantry":"4 years","refrigerator":"","shortName":"allspice"},{"freezer":"","name":"almond extract, pure or imitation, commercially bottled - unopened or opened","pantry":"4 years","refrigerator":