Skip to content

Instantly share code, notes, and snippets.

View dhaneshgosai's full-sized avatar
🤝
Nothing is impossible | Code ~> Run ~> Test ~> Achieve

CodeChanger dhaneshgosai

🤝
Nothing is impossible | Code ~> Run ~> Test ~> Achieve
  • Pune,Maharastra,India.
View GitHub Profile
@dhaneshgosai
dhaneshgosai / timeago.swift
Created February 24, 2020 17:48 — forked from minorbug/timeago.swift
"Time ago" function for Swift (based on MatthewYork's DateTools for Objective-C)
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let unitFlags = NSCalendarUnit.CalendarUnitMinute | NSCalendarUnit.CalendarUnitHour | NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitWeekOfYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitSecond
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components(unitFlags, fromDate: earliest, toDate: latest, options: nil)
if (components.year >= 2) {
return "\(components.year) years ago"
//
// ItunesAppInfoItunes.swift
//
// Created by CodeChanger on 03/11/19.
// Copyright © 2019 CodeChanger. All rights reserved.
//
import Foundation
//
// ItunesAppInfoResult.swift
//
// Created by CodeChanger on 03/11/19.
// Copyright © 2019 CodeChanger. All rights reserved.
//
import Foundation
@dhaneshgosai
dhaneshgosai / AppStoreUpdate.swift
Last active April 27, 2023 09:29
This Gist Class for Checking App Store version with local version.
//
// AppStoreUpdate.swift
//
// Created by CodeChanger on 03/11/19.
// Copyright © 2019 CodeChanger. All rights reserved.
//
import UIKit
enum CustomError: Error {
@dhaneshgosai
dhaneshgosai / FirebasePhoneAuthIonicV3.md
Created March 12, 2019 13:02 — forked from kkrishnan90/FirebasePhoneAuthIonicV3.md
Firebase Phone Auth using Ionic V3 - Sending and reading OTP

General Steps to be followed as a flow process to complete Firebase Phone OTP Auth in Ionic V3

Step 1 : Get the phone number through input from the user. Step 2 : Pass this phone number to the firebase and receive a callback with verification ID. Step 3 : Pass on this verification ID through navParams to the next page where the user will enter the OTP sent to the entered mobile number. Step 4 : Verify the OTP that is sent with firebase for success() or failure() .

STEP 1 & 2 & 3

phone-verification.html

@dhaneshgosai
dhaneshgosai / NVActivityIndicatorView.swift
Last active September 28, 2017 06:08
NVActivityIndicatorView
// Activity indicator view with nice animations
@objc public final class NVActivityIndicatorView: UIView {
/// Default type. Default value is .BallSpinFadeLoader.
public static var DEFAULT_TYPE: NVActivityIndicatorType = .ballSpinFadeLoader
/// Default color of activity indicator. Default value is UIColor.white.
public static var DEFAULT_COLOR = UIColor.white
/// Default color of text. Default value is UIColor.white.
public static var DEFAULT_TEXT_COLOR = UIColor.white
@dhaneshgosai
dhaneshgosai / Device.swift
Created January 27, 2017 07:29 — forked from imkevinxu/Device.swift
iOS device checks for OS version and screen size in Swift
//
// Device.swift
// imHome
//
// Created by Kevin Xu on 2/9/15. Updated on 6/20/15.
// Copyright (c) 2015 Alpha Labs, Inc. All rights reserved.
//
import Foundation
@dhaneshgosai
dhaneshgosai / podforceupdate.sh
Created January 25, 2017 13:02 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update