Skip to content

Instantly share code, notes, and snippets.

View psaitu's full-sized avatar
👋
hello!

Prabhu Saitu psaitu

👋
hello!
View GitHub Profile
@psaitu
psaitu / mail.txt
Created August 17, 2016 11:45
Curl 101
From: "User Name" <username@gmail.com>
To: "John Smith" <john@example.com>
Subject: This is a test
Hi John,
I'm sending this mail with curl thru my gmail account.
Bye!
to.view.center = offsetCenter
container.addSubview(to.view)
UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.0, options: .CurveLinear, animations: {
from.view.alpha = 0.5
to.view.center = from.view.center
}, completion: {
finished in
transitionContext.completeTransition(true)
let bounds = UIScreen.mainScreen().bounds
let offsetCenter = CGPoint(x: bounds.width / 2, y: bounds.height + 300)
let from = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!
let to = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!
let container = transitionContext.containerView()!
import Foundation
import UIKit
class PopUpTransition: NSObject, UIViewControllerAnimatedTransitioning {
private var presenting:Bool = false
func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
return 0.4
@psaitu
psaitu / PopUpViewController.swift
Created July 5, 2016 12:38
Code Snippets For Blog Post -
import UIKit
class PopUpViewController: UIViewController {
@IBOutlet weak var actionButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
@psaitu
psaitu / WindowController.swift
Created June 13, 2016 09:44
Custom App Delegate
import UIKit
@UIApplicationMain class WindowController: UIResponder {
var window: UIWindow? = {
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
window.rootViewController = UINavigationController(rootViewController: ViewController())
return window
}()
}
@psaitu
psaitu / BookCell.swift
Created May 14, 2016 14:08
Better tableviews using generics
import UIKit
class BookCell: UITableViewCell {
@IBOutlet weak var redLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
@psaitu
psaitu / Zomato.swift
Created May 14, 2016 13:59
Sample Moya Target
//
// Zomato.swift
// BiryaniAF
//
// Created by Prabhu Saitu on 13/05/16.
// Copyright © 2016 Prabhu Saitu. All rights reserved.
//
import Foundation
import Moya
//
// AppDelegate.swift
// SpotsPugs
//
// Created by Prabhu Saitu on 24/04/16.
// Copyright © 2016 Prabhu Saitu. All rights reserved.
//
import UIKit
import Spots