Skip to content

Instantly share code, notes, and snippets.

View dipkasyap's full-sized avatar

Devi Pd. Ghimire (Dip Kasyap) dipkasyap

View GitHub Profile
@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:

@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 / 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 / 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
//
// AppRater.swift
//
// Created by Devi Prasad Ghimire on 6/12/19.
//
import Foundation
import StoreKit
@dipkasyap
dipkasyap / 1_playground.swift
Created November 14, 2019 00:36 — forked from morishin/1_playground.swift
Circular UIView with drop shadow (using UIBezierPath)
import UIKit
import PlaygroundSupport
let container = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 200))
container.backgroundColor = .lightGray
let buttonRadius: CGFloat = 50
let buttonSize = CGSize(width: buttonRadius * 2, height: buttonRadius * 2)
let buttonPath = UIBezierPath(arcCenter: CGPoint(x: buttonRadius, y: buttonRadius), radius: buttonRadius, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: true)
@dipkasyap
dipkasyap / publish2iTunesConnect.sh
Created February 18, 2019 05:50 — forked from BYCHEN/publish2iTunesConnect.sh
Automation build xcode project, ipa, and upload to Apple testFlight
#!/bin/bash -l
#
#
#
# version 0.0.1
#
#
# Configurations Setting
##########################################################################
WORKSPACE="<SET Workspace name>"
Advanced Animations with UIKit
video: https://devstreaming-cdn.apple.com/videos/wwdc/2017/230lc4n1loob9/230/230_hd_advanced_animations_with_uikit.mp4?dl=1
pdf: https://devstreaming-cdn.apple.com/videos/wwdc/2017/230lc4n1loob9/230/230_advanced_animations_with_uikit.pdf
Advanced Touch Bar
video: https://devstreaming-cdn.apple.com/videos/wwdc/2017/222ijxk2akkrebmr/222/222_hd_advanced_touch_bar.mp4?dl=1
pdf: https://devstreaming-cdn.apple.com/videos/wwdc/2017/222ijxk2akkrebmr/222/222_advanced_touch_bar.pdf
Advances in TVMLKit
video: https://devstreaming-cdn.apple.com/videos/wwdc/2017/202ximbb9e2dq222/202/202_hd_advances_in_tvmlkit.mp4?dl=1
//
// LoadingOverlay.swift
// app
//
// Created by Igor de Oliveira Sa on 25/03/15.
// Copyright (c) 2015 Igor de Oliveira Sa. All rights reserved.
//
// Usage:
//
// # Show Overlay
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit