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:4836d90bc50b7ad52c042a9bb9e92e46
Created January 11, 2017 20:41
View Controller Containment Injecting Empty Views
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
typealias JSONDictionary = [String:Any]
struct Resource<T> {
let url :URL
@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,
<html>
<head>
<script src="https://unpkg.com/react@15/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
<script src="https://npmcdn.com/react-router/umd/ReactRouter.min.js"></script>
</head>
/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
let text = SCNText(string: item.label, extrusionDepth: 5.0)
text.firstMaterial?.diffuse.contents = UIColor.orange
text.firstMaterial?.specular.contents = UIColor.orange
text.font = UIFont(name: "Optima", size: 44)
text.containerFrame = CGRect(x: 0, y: 0, width: 100, height: 44)
let textNode = SCNNode(geometry: text)
textNode.position = SCNVector3(-0.2 + x, -0.9 + delta, -1)
x += 0.12
@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 {