This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
func letterCombinations(_ digits: String) -> [String] { | |
let phone: [String: String] = ["2": "abc", "3": "def", "4": "ghi", "5": "jkl", "6": "mno", "7": "pqrs", "8": "tuv", "9": "wxyz"] | |
var output: [String] = [] | |
func backTrack(combination: String, next_digits: String) { | |
if next_digits.count == 0 { | |
output.append(combination) | |
} else { | |
let digit = String(next_digits[next_digits.startIndex..<next_digits.index(next_digits.startIndex, offsetBy: 1)]) | |
let letters: String = phone[digit] ?? "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ImageExt.swift | |
// Dabbagul | |
// | |
// Created by Hemant Singh on 06/05/17. | |
import Foundation | |
import Alamofire | |
extension UIImageView { | |
var documentsUrl: URL { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
var address : String? | |
// Get list of all interfaces on the local machine: | |
var ifaddr : UnsafeMutablePointer<ifaddrs>? | |
guard getifaddrs(&ifaddr) == 0 else { return nil } | |
guard let firstAddr = ifaddr else { return nil } | |
// For each interface ... | |
for ifptr in sequence(first: firstAddr, next: { $0.pointee.ifa_next }) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void getFeeds() { | |
if (mRetrofit == null){ | |
mRetrofit = RestClient.getClient(); | |
} | |
apiInterface = mRetrofit.create(ApiInterface.class); | |
Call<FeedResponse> call = apiInterface.getFeed(Initializer.readFromPreferences(getContext(), Constants.SPKeys.authTokenKey,"")); | |
call.enqueue(new retrofit2.Callback<FeedResponse>() { | |
@Override | |
public void onResponse(Call<FeedResponse> call, Response<FeedResponse> response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.media.MediaMetadataRetriever; | |
import android.os.AsyncTask; | |
import android.os.Environment; | |
import android.widget.ImageView; | |
import org.apache.commons.io.FilenameUtils; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let circlePath2 = UIBezierPath(arcCenter: CGPoint(x: self.swapBtn.frame.midX, y: self.swapBtn.frame.midY), radius: -self.frame.width/3, startAngle: CGFloat(M_PI * 2.0), endAngle: CGFloat(M_PI) , clockwise: false) | |
let animation2 = CAKeyframeAnimation(keyPath: "position"); | |
animation2.duration = 0.7 | |
animation2.repeatCount = MAXFLOAT | |
animation2.path = circlePath2.cgPath | |
animation2.repeatCount = 0 | |
animation2.fillMode = kCAFillModeForwards | |
animation2.isRemovedOnCompletion = false | |
let circlePath = UIBezierPath(arcCenter: CGPoint(x: self.swapBtn.frame.midX, y: self.swapBtn.frame.midY), radius: -self.frame.width/3, startAngle: CGFloat(M_PI) , endAngle: CGFloat(M_PI * 2.0) , clockwise: true) | |
let animation = CAKeyframeAnimation(keyPath: "position"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alertController = UIAlertController(title:"" , message: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", preferredStyle: UIAlertControllerStyle.actionSheet) | |
let view = (collectionView.cellForItem(at: indexPath)?.contentView)!.copyView() | |
alertController.view.addSubview(view) | |
let cancelAction = UIAlertAction(title: "Done", style: .cancel, handler: {(alert: UIAlertAction!) in | |
collectionView.reloadData() | |
}) | |
alertController.addAction(cancelAction) | |
alertController.popoverPresentationController?.sourceView = collectionView.cellForItem(at: indexPath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HSCache.swift | |
// Cache | |
// | |
// Created by Hemant Singh on 10/11/16. | |
// Copyright © 2016 Hemant Singh. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Showing the menu action sheet | |
var documentMediaTypes: [String] = [] | |
documentMediaTypes.append(String(kUTTypePDF)) | |
documentMediaTypes.append(String(kUTTypePNG)) | |
documentMediaTypes.append(String(kUTTypeImage)) | |
documentMediaTypes.append(String(kUTTypeVideo)) | |
documentMediaTypes.append(String(kUTTypeMovie)) | |
documentMediaTypes.append(String(kUTTypeItem)) | |
NewerOlder