Skip to content

Instantly share code, notes, and snippets.

View azamsharp's full-sized avatar

Mohammad Azam azamsharp

View GitHub Profile
@azamsharp
azamsharp / .js
Created July 23, 2018 13:41
MovieList
import React, {Component} from 'react'
import {Link} from 'react-router-dom'
export class MovieList extends Component {
constructor(props) {
super(props)
this.state = {
const redux = require('redux')
const createStore = redux.createStore
const initialState = {
posts : []
}
import React, {Component} from 'react'
import {connect} from 'react-redux'
class Counter extends Component {
constructor(props) {
super(props)
import Foundation
import UIKit
import Intents
import CoreSpotlight
import CoreServices
@IBAction func donate() {
// perform an actual order here
import { createStore, combineReducers } from 'redux'
const rootReducer = combineReducers({
ctr : counterReducer,
res : resultReducer
})
// map state to properties
const mapStateToProps = (state) => {
// create a random location ;)
let location = CLLocation(latitude: 40.762428, longitude: -73.973794)
let placemark = CLPlacemark(location: location, name: "Your Mom's House", postalAddress: nil)
let orderCoffeeIntent = OrderCoffeeIntent()
orderCoffeeIntent.setImage(INImage(named: "coffee.jpg"), forParameterNamed: \.coffeeName)
orderCoffeeIntent.coffeeName = coffeeName
orderCoffeeIntent.deliveryLocation = placemark
let interaction = INInteraction(intent: orderCoffeeIntent, response: nil)
interaction.donate { error in
if let error = error {
print(error.localizedDescription)
}
}
import Intents
class IntentHandler: INExtension, OrderCoffeeIntentHandling {
func confirm(intent: OrderCoffeeIntent, completion: @escaping (OrderCoffeeIntentResponse) -> Void) {
completion(OrderCoffeeIntentResponse(code: .ready, userActivity: nil))
}
func handle(intent: OrderCoffeeIntent, completion: @escaping (OrderCoffeeIntentResponse) -> Void) {
import Foundation
import UIKit
// InvoiceView.swift
class InvoiceView :UIView {
@IBOutlet weak var coffeeNameLabel :UILabel!
@IBOutlet weak var deliveryLocationLabel :UILabel!
}