Skip to content

Instantly share code, notes, and snippets.

View azamsharp's full-sized avatar

Mohammad Azam azamsharp

View GitHub Profile
// 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 {
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))
@azamsharp
azamsharp / .kt
Last active August 2, 2018 04:48
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())
}
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')
@azamsharp
azamsharp / .swift
Last active September 14, 2018 17:12
unwrapping
import UIKit
let jsonData :Data = """
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
@azamsharp
azamsharp / .swift
Created September 15, 2018 22:24
Category Structure
struct Category :Decodable {
let categoryName :String
let detail :[Detail]
struct Detail :Decodable {
let category :String
let trailerPrice :String
let isWatchlist :Bool?
}
@azamsharp
azamsharp / .py
Created September 19, 2018 13:43
# 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",
@azamsharp
azamsharp / .js
Created October 5, 2018 13:13
javascript 101
// 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")
}
// 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)
//https://jsonplaceholder.typicode.com/todos/1
let container = document.getElementById("container")
function displayResult(result) {
container.innerHTML =
`<p>${result.title}</p>
<p>${result.userId}</p>