This file contains hidden or 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
// Prepare your view controller for the interaction to handle. | |
func configureView(for parameters: Set<INParameter>, of interaction: INInteraction, interactiveBehavior: INUIInteractiveBehavior, context: INUIHostedViewContext, completion: @escaping (Bool, Set<INParameter>, CGSize) -> Void) { | |
guard let intent = interaction.intent as? OrderCoffeeIntent else { | |
completion(false, Set(), .zero) | |
return | |
} | |
// clear out all the views | |
for childView in view.subviews { |
This file contains hidden or 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
private func displayInvoice(name :String, deliveryLocation :CLPlacemark) -> CGSize { | |
self.invoiceView.coffeeNameLabel.text = name | |
self.invoiceView.deliveryLocationLabel.text = deliveryLocation.name | |
self.view.addSubview(self.invoiceView) | |
let width = self.extensionContext?.hostedViewMaximumAllowedSize.width ?? 320 | |
let frame = CGRect(origin: .zero, size: CGSize(width: width, height: 170)) | |
This file contains hidden or 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
fun main(args :Array<String>) { | |
val names = listOf("Alex","Mary","John") | |
println(names.toBulletList()) | |
val numbers = listOf(3,4,5,12,67,8) | |
println(numbers.toBulletList()) | |
} |
This file contains hidden or 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
self.addEventListener('install',function(event){ | |
console.log("Service Worker Installing Service Worker",event) | |
/* | |
event.waitUntil( | |
caches.open('static') | |
.then(function(cache){ | |
// cache.add('/') | |
// cache.add('/index.html') |
This file contains hidden or 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 UIKit | |
let jsonData :Data = """ | |
{ | |
"id": 1, | |
"name": "Leanne Graham", | |
"username": "Bret", | |
"email": "[email protected]", |
This file contains hidden or 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
struct Category :Decodable { | |
let categoryName :String | |
let detail :[Detail] | |
struct Detail :Decodable { | |
let category :String | |
let trailerPrice :String | |
let isWatchlist :Bool? | |
} |
This file contains hidden or 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
# customer dictionary with address and geo as additional | |
# dictionaries inside it | |
customer = {"firstName":"John","lastName":"Doe", | |
"address":{"street":"1200 Richmond","state":"TX","zipCode":"77066","geo":{ | |
"latitude":123, "longitude":123.122 | |
}} | |
} | |
new_customer = { | |
"firstName":"Steven", |
This file contains hidden or 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
// console output is not visible to normal user | |
console.log("hello world") | |
var name = "John" | |
var age = 23 | |
// creating a function with no parameters | |
function greet() { | |
console.log("calling function greet") | |
} |
This file contains hidden or 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
// jquery function | |
// fires when the DOM is READY | |
$(document).ready(function(){ | |
console.log("DOM is loaded") | |
console.log("Access the Div1 element inside document.ready") | |
// jquery get element by id | |
let div1 = $("#div1") | |
console.log(div1) |
This file contains hidden or 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
//https://jsonplaceholder.typicode.com/todos/1 | |
let container = document.getElementById("container") | |
function displayResult(result) { | |
container.innerHTML = | |
`<p>${result.title}</p> | |
<p>${result.userId}</p> |