Skip to content

Instantly share code, notes, and snippets.

View dipkasyap's full-sized avatar

Devi Pd. Ghimire (Dip Kasyap) dipkasyap

View GitHub Profile
//
// AppRater.swift
//
// Created by Devi Prasad Ghimire on 6/12/19.
//
import Foundation
import StoreKit
@dipkasyap
dipkasyap / WebCacheCleaner.swift
Created January 13, 2020 03:23 — forked from insidegui/WebCacheCleaner.swift
Clear WKWebView's cookies and website data storage, very useful during development.
import Foundation
import WebKit
final class WebCacheCleaner {
class func clean() {
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
print("[WebCacheCleaner] All cookies deleted")
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
{
"_embedded": {
"hospitals": [
{
"id": 1,
"name": "St Vincent's Hospital",
"waitingList": [
{
"patientCount": 10,
@dipkasyap
dipkasyap / TwoWaySnapList.swift
Created August 22, 2022 07:44 — forked from sameersyd/TwoDirectionalSnapList.swift
SwiftUI - Two Directional SnapList
// Checkout the explanation article here - https://sameer-syd.medium.com/swiftui-two-directional-snaplist-95cb852957be
import SwiftUI
import Combine
struct HomeView: View {
@StateObject var viewModel: HomeViewModel
@dipkasyap
dipkasyap / gist:496f8ebba273db1af02bc36af5510bd5
Created November 25, 2022 01:48 — forked from wavecos/gist:4dcb1410a41b9dd521cb
Present Modal ViewController when tap a TabBarItem (like camera VC in Instagram)
// 1. First Create a Dummy UIViewController that has a root relation with the UITabBarController
// 2. Make this controller implement a UITabBarControllerDelegate
// 3. In ViewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
self.tabBarController?.delegate = self
}
// 4. Implement this delegate method:
func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
let isModalTab = viewController == self
@dipkasyap
dipkasyap / pr.md
Created May 4, 2023 01:50 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: