Skip to content

Instantly share code, notes, and snippets.

@ajayjapan
ajayjapan / motionMonitoring.swift
Last active November 29, 2018 13:01
Here App Motion Monitoring and Notification Skipping Logic
// MARK - Motion Tracking Logic
func startTrackingMotionActivity(handler: @escaping (CMMotionActivity) -> Void) {
manager.startActivityUpdates(to: .main) { (activity) in
guard let activity = activity else { return }
if let lastActivity = self.currentActivity, lastActivity.automotive {
self.stoppedDrivingAt = Date() // now
}
self.currentActivity = activity
handler(activity)
@ajayjapan
ajayjapan / example.swift
Last active November 28, 2018 11:15
UNLocationNotificationTrigger Example
// Define the content of the notification
let content = UNMutableNotificationContent()
content.title = place.title
content.body = place.blurb
content.sound = UNNotificationSound.default()
// Define the region
let region = CLCircularRegion(center: place.coordinate(), radius: place.radius ?? 100, identifier: place.identifier)
region.notifyOnEntry = true
region.notifyOnExit = false
import spacy
nlp = spacy.load("en_core_web_sm")
article = "This is the content of the article. It consists of many sentences."
doc = nlp(article)
[sent.text for sent in doc.sents]
# Output: [‘This is the content of the article.’, ‘It consists of many sentences.’]
import spacy
nlp = spacy.load("en_core_web_sm")
article = "I have lived in Philadelphia for most of my life. I went to school in New York City."
doc = nlp(article)
[sent for sent in doc.ents]
# Output: [Philadelphia, New York City]
{
"id": 302228,
"content": "Philadelphia reported 126 new COVID-19 cases and 17 deaths Friday.",
"bert_tags": [
"Philadelphia"
],
"identifier": "default",
"article_id": 5097
}
@ajayjapan
ajayjapan / ios-url-schemes.json
Last active January 8, 2025 01:26 — forked from bartleby/iOS URL Schemes
iOS URL Schemes
{
"URL Schemes": {
"Apple Music": [
{
"description": "Opens an album in Apple Music",
"url": "music://geo.itunes.apple.com/us/albums/<albumID>"
},
{
"description": "Opens an artist in Apple Music",
"url": "music://geo.itunes.apple.com/us/artists/<artistID>"