Skip to content

Instantly share code, notes, and snippets.

View nazmulkp's full-sized avatar

Nazmul Hasan nazmulkp

View GitHub Profile
item[details]
Mixed Herbs + €0, Base - Regular Base, Sauce - Our Signature Tomato Sauce, Cheese - Mozzarella, Topping 1 - None, Topping 2 - None, Topping 3 - None, Topping 4 - None, Would You Like Any Extra Toppings? (€1 per topping) - Ham, ,
item[dishId]
464
item[price]
6.99
item[quantity]
1
item[shopId]
51
@nazmulkp
nazmulkp / gist:8b6927c16254e9956d99395f74eff535
Last active March 7, 2017 10:57
How to switch views programmatically in a ViewController?
talk with segue :
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//TODO:
// showShop(shop: shops[indexPath.row])
performSegue(withIdentifier: "ShopIdentifire", sender: indexPath)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
@nazmulkp
nazmulkp / gist:81996ad27b641dc179385d169d66e166
Last active February 16, 2017 06:49
UITableViewCell subviews not moving when editing enabled in NSLayoutConstraint
override func setEditing(_ editing: Bool, animated: Bool) {
// Toggles the edit button state
super.setEditing(editing, animated: animated)
// Toggles the actual editing actions appearing on a table view
tableView.setEditing(editing, animated: true)
}
@nazmulkp
nazmulkp / gist:c0b57185f76fb426634c65eb0476889e
Last active February 15, 2017 09:30
how can i reuse UIView Swift ?
var sparteLine : UIView = {
var view = UIView()
view.backgroundColor = UIColor.blue
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()
//Dish Comment
var disComment : LeftPaddingLabel = {
var label = LeftPaddingLabel()
The following viewDidLoad will (1) set two locations, (2) remove all the previous annotations, and (3) call user defined helper functions (to get route points and draw the route).
var loc1: CLLocationCoordinate2D
loc1.latitude = 29.0167
loc1.longitude = 77.3833
var origin = Annotation(title: "loc1", subTitle: "Home1", andCoordinate: loc1)
objMapView.addAnnotation(origin)
// Destination Location.
var loc2: CLLocationCoordinate2D
loc2.latitude = 19.076000
func fetchJSON(from url: URL) -> RACSignal {
print("Fetching: \(url.absoluteString)")
// 1
return RACSignal.createSignal({(_ subscriber: RACSubscriber) -> RACDisposable in
// 2
var dataTask = self.session.dataTask(withURL: url, completionHandler: {(_ data: Data, _ response: URLResponse, _ .error: Error) -> Void in
// TODO: Handle retrieved data
})
// 3
dataTask.resume()
@nazmulkp
nazmulkp / gist:a0e8b54064d4d6facaa4d79ae673f649
Created November 27, 2016 17:04
iOS Apps with REST APIs
Basic set up for API
iOS developer resource ... all kind of plugin