Skip to content

Instantly share code, notes, and snippets.

View hemant3370's full-sized avatar
๐Ÿ˜ƒ
Focusing

Hemant Singh hemant3370

๐Ÿ˜ƒ
Focusing
View GitHub Profile
@hemant3370
hemant3370 / ThumbnailExtract.java
Created March 28, 2017 18:49
Download video thumbnail from url and cache it to disk
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;
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
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) {
{
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 }) {
@hemant3370
hemant3370 / ImageViewExtension.swift
Last active May 6, 2017 08:21
image loading and disk saving using alamofire
//
// ImageExt.swift
// Dabbagul
//
// Created by Hemant Singh on 06/05/17.
import Foundation
import Alamofire
extension UIImageView {
var documentsUrl: URL {
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] ?? ""