Skip to content

Instantly share code, notes, and snippets.

View azamsharp's full-sized avatar

Mohammad Azam azamsharp

View GitHub Profile
@azamsharp
azamsharp / gist:6c1530b681e613b5711c
Created June 11, 2014 16:46
Easily Creating Blur Effect for UITableViewCells Using iOS 8 VisualEffectView
//
// FlowersTableViewController.swift
// Flowers++
//
// Created by Mohammad Azam on 6/6/14.
// Copyright (c) 2014 AzamSharp Consulting LLC. All rights reserved.
// www.azamsharp.com
// www.youtube.com/azamsharp
@azamsharp
azamsharp / gist:d6adec07a9562ffd91536ed25c2cd77e
Created January 17, 2017 17:35
Reflection to Create Views in Swift
struct LoginViewModel : ViewModel {
var userName :String
var password :String
}
class UIEngine<ViewModel> {
var viewModel :ViewModel
[
{
"id":1,
"imageURL":"http:\/\/vignette4.wikia.nocookie.net\/pokemon\/images\/5\/5f\/025Pikachu_OS_anime_11.png",
"latitude":29.817841,
"longitude":-95.387421,
"name":"Pikachu"
},
{
"id":2,
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=60983:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre/lib/ext/sunec.jar
@azamsharp
azamsharp / gist:26beb1677be0a1570f63d673b5a47f29
Created July 13, 2017 19:54
Plane Height Causing Issues in Positioning the Plane
I am using ARKit to find horizontal plane and then cover the plane with a grid image using SCNPlane geometry. If I use the following code to update my plane extend then it works fine.
func update(anchor :ARPlaneAnchor) {
self.planeGeometry.width = CGFloat(anchor.extent.x * Float(scaleX)); // scaleX is 10
self.planeGeometry.height = CGFloat(anchor.extent.z);
self.position = SCNVector3Make(anchor.center.x, 0, anchor.center.z);
let planeNode = self.childNodes.first!
@azamsharp
azamsharp / gist:5d89c3d4c657647e0add5d7b3eb16c50
Created September 27, 2017 20:28
Pool Table Reservation
import datetime
poolTables = []
class PoolTable:
def __init__(self):
self.number = 0
self.startDate = 0
ViewController.swift:
for item in response.mapItems {
let placeLocation = (item.placemark.location)!
let placeAnnotationNode = PlaceAnnotation(location: placeLocation)
placeAnnotationNode.scale = SCNVector3(0.1, 0.1, 0.1)
DispatchQueue.main.async {
func loadArticles(callback :([Article] -> ())) {
URLSession.shared.dataTask(with: url) { data, response, error in
if let data = data {
let json = try! JSONSerialization.jsonObject(with: data, options: [])
let dictionary = json as! JSONDictionary
let articleDictionaries = dictionary["articles"] as! [JSONDictionary]
func loadArticles(callback :([Article] -> ())) {
URLSession.shared.dataTask(with: url) { data, response, error in
if let data = data {
let json = try! JSONSerialization.jsonObject(with: data, options: [])
let dictionary = json as! JSONDictionary
let articleDictionaries = dictionary["articles"] as! [JSONDictionary]
struct ArticleListViewModel {
var title :String? = "Articles"
var articles :[ArticleViewModel] = [ArticleViewModel]()
}
extension ArticleListViewModel {
init(articles :[ArticleViewModel]) {
self.articles = articles