Skip to content

Instantly share code, notes, and snippets.

View mrugeshtank's full-sized avatar
🎯
Focusing

Mrugesh Tank mrugeshtank

🎯
Focusing
View GitHub Profile
@mrugeshtank
mrugeshtank / gist:5ed4b5631f0c432356ba9c60b593b956
Created October 24, 2017 13:49 — forked from snikch/gist:3661188
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@mrugeshtank
mrugeshtank / map-reduce-filter-flatMap.swift
Created October 24, 2017 13:49 — forked from phynet/map-reduce-filter-flatMap.swift
Examples for flatMap, Map, Reduce, Filter in Swift
//reduce
//Use reduce to combine all items in a collection to create a single new value.
let numbers = [1, 3, 5, 7, 9]
//sum all values from the array (+)
let result = numbers.reduce(0, +)
//sum all values from the array (+) plus one
let result2 = numbers.reduce(1, +)
let result3 = numbers.reduce(1, *)
@mrugeshtank
mrugeshtank / CountryCodes.json
Created December 13, 2017 11:31 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
@mrugeshtank
mrugeshtank / statusCode.php
Last active December 23, 2017 11:45 — forked from henriquemoody/http-status-codes.php
List of HTTP status codes in PHP
<?php
/**
* Content from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
**/
return array(
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing', // WebDAV; RFC 2518
200 => 'OK',
@mrugeshtank
mrugeshtank / IAPHelper.txt
Created February 8, 2018 13:12 — forked from speaktoalvin/IAPHelper.txt
In App Purchase in Swift, with Receipt Validation
import UIKit
import StoreKit
//MARK: SKProductsRequestDelegate
extension IAPHelpers : SKProductsRequestDelegate
{
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse)
{
//
// InAppManager.swift
//
// Created by Ellina Kuznetcova on 12/10/2016.
// Copyright © 2016 Flatstack. All rights reserved.
//
import Foundation
import StoreKit
@mrugeshtank
mrugeshtank / Playground.swift
Created November 28, 2018 13:24 — forked from tikipatel/Playground.swift
Quick Playground for adding rows to the top of a tableview
import PlaygroundSupport
import UIKit
class TableViewManager: NSObject, UITableViewDataSource, UITableViewDelegate {
weak var tableView: UITableView?
var strings = ["a", "b", "c", "d","e", "f", "g", "h","i", "j", "k", "dl","am", "bn", "co", "dp","aq", "br", "cs", "dt","au", "bv", "cw", "dx","ay", "bz", "caa", "dbb","acc", "bdd", "cee", "dff","agg", "bhh", "cii", "djj","akk", "bll", "cmm", "dnn","aoo", "bpp", "cqq", "zrr"]
func add(data: [String]) {
@mrugeshtank
mrugeshtank / README.md
Created December 29, 2018 05:30 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@mrugeshtank
mrugeshtank / database.rules.json
Created March 29, 2019 11:17 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}