Skip to content

Instantly share code, notes, and snippets.

View uniruddh's full-sized avatar
🎯
Focusing

Aniruddh Bhilvare uniruddh

🎯
Focusing
View GitHub Profile
@uniruddh
uniruddh / AlamofireAndServerTrustPolicies
Created October 4, 2022 14:22 — forked from jinal90/AlamofireAndServerTrustPolicies
Code snippet to explain a SSL pinning Alamofire and Server trust policy.
// 1. Basic configuration for creating Alamofire manager
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
configuration.timeoutIntervalForRequest = 60
var serverTrustPolicies: [String: ServerTrustPolicy] = [:]
// 2. Pass your certificate filename, type and directory path to load the cefrtificate
guard let certificatePath = Bundle.main.path(forResource: "CertificateFileName", ofType: "der", inDirectory: "assets/certificate") else{
@uniruddh
uniruddh / FTPExample.java
Created August 20, 2019 15:38 — forked from madan712/FTPExample.java
Java program to upload/download files from remote server
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
@uniruddh
uniruddh / RestService.swift
Last active July 8, 2018 18:55
Simple Class for making Rest API calls in swift.
import Foundation
import UIKit
class RestService{
/**
GET respons from REST API.
:param: reqUrl URL of webservice.
:param: completionHandler callback function, this will called once you get response.
@uniruddh
uniruddh / MVP + Interactor example.kt
Created June 11, 2018 11:47 — forked from marciogranzotto/MVP + Interactor example.kt
This is an example of Android development with MVP + Interactor in Kotlin
interface LoginContracts {
interface View {
fun presentHomeScreen(user: User)
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}
@uniruddh
uniruddh / VIPER Android Example.kt
Created June 11, 2018 11:47 — forked from marciogranzotto/VIPER Android Example.kt
This is an example of Android development with VIPER in Kotlin
interface LoginContracts {
interface View {
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}
@uniruddh
uniruddh / Libraries.md
Last active February 7, 2017 05:35
Android Helpful Libraries
@uniruddh
uniruddh / Utils.java
Last active March 15, 2016 07:13
Helper class for most important and basic methods for any Android App.
public class Utils {
/*
* Usage: Check if device have internet connection or not, before communicating with server.
* @param ctx: Context form which this method will be called
* @return Boolean: If internet is available or not.
*/
public static boolean isNetConnected(Context ctx) {
Runtime runtime = Runtime.getRuntime();
try {