Skip to content

Instantly share code, notes, and snippets.

View brunojppb's full-sized avatar
🌱
code gardening...

Bruno Paulino brunojppb

🌱
code gardening...
View GitHub Profile
@brunojppb
brunojppb / wwdc15.md
Last active August 29, 2015 14:24 — forked from mackuba/wwdc15.md

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Register for push notifications
let notificationTypes: UIUserNotificationType = .Badge | .Sound | .Alert
let notificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
// Ask user permission
UIApplication.sharedApplication().registerForRemoteNotifications()
return true
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
// Create and Store the device token on local database and send
// Token to backend API
// 1:
// remove "<" and ">" from the string
let trimEnds = token.description.stringByTrimmingCharactersInSet(NSCharacterSet(charactersInString: "<>"))
// 2:
// remove spaces
let cleanToken = trimEnds.stringByReplacingOccurrencesOfString(" ", withString: "", options: nil)
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
// Do whatever you want with this notification
// Ex: Reload data from server
NSLog("remote Notification: %@", userInfo)
}
# Development
openssl pkcs12 -in development.p12 -out development.pem -nodes -clcerts
# Production
openssl pkcs12 -in production.p12 -out production.pem -nodes -clcerts
gem "apns"
# config/initializers/apns.rb
# Default value is 'gateway.sandbox.push.apple.com'
APNS.host = "gateway.sandbox.push.apple.com"
# Path to your development.pem file
APNS.pem = File.join(Rails.root, "development.pem")
# if your iOS App is available on the App Store, Use the production.pem
# and change the host
if Rails.env.production?
APNS.host = "gateway.push.apple.com"
class PostsController < ApplicationController
def create
post = Post.new(post_params)
# Get all devices stored on your database
# or filter based on your criteria
devices = Device.all
notifications = devices.map do |d|
APNS::Notification.new(d.token,
alert: post.title,
bundle install