Skip to content

Instantly share code, notes, and snippets.

View SwapnanilDhol's full-sized avatar
🏠
Working from home

Swapnanil Dhol SwapnanilDhol

🏠
Working from home
View GitHub Profile
@SwapnanilDhol
SwapnanilDhol / apple-shorten.py
Created October 24, 2022 08:26
Apple Media Tools Shorten Link
import requests
from bs4 import BeautifulSoup
longURL = input('Enter the long media URL: ')
homePageURL = "https://tools.applemediaservices.com/"
homePageRequest = requests.get(homePageURL)
soup = BeautifulSoup(homePageRequest.content, "lxml")
meta = soup.find("meta", attrs={'name': 'csrf-token'})
{
"kind": "youtube#videoListResponse",
"etag": "uFAZK6gMs-vWa9z2Z_m7CX5asXM",
"items": [
{
"kind": "youtube#video",
"etag": "hYMZ2Vgp3in1woc8Ou0LH8XGN1Y",
"id": "ISdBAf-ysI0",
"snippet": {
"publishedAt": "2018-03-20T17:00:01Z",
@SwapnanilDhol
SwapnanilDhol / HapticsHelper.swift
Last active September 12, 2020 14:35
A Swift Helper class to generate different types of haptics from one class. Just initialize this once in your view controller and call the methods when you need them.
/*****************************************************************************
* FeedbackGenerators.swift
* Neon: Capture, Edit, Share
*****************************************************************************
* Copyright (c) 2020 Neon. All rights reserved.
*
* Authors: Swapnanil Dhol <swapnanildhol # gmail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
@SwapnanilDhol
SwapnanilDhol / ItemDetailSource.swift
Created August 21, 2020 13:06
A UIActivity Helper Class to show thumbnail preview and text in the share sheet title area
//
// ItemDetailSource.swift
// StickerTweet
//
// Created by Swapnanil Dhol on 7/9/20.
// Copyright © 2020 Swapnanil Dhol. All rights reserved.
//
import UIKit
import LinkPresentation
//
// UITableView+EmptyView.swift
// StickerTweet
//
// Created by Swapnanil Dhol on 7/6/20.
// Copyright © 2020 Swapnanil Dhol. All rights reserved.
//
import UIKit
@SwapnanilDhol
SwapnanilDhol / AppIconChangeController.swift
Created July 17, 2020 13:10
Change App Icon in an iOS/iPadOS application.
//
// AppIconChangeController.swift
// Color Picker
//
// Created by Swapnanil Dhol on 2/5/20.
// Copyright © 2020 Swapnanil Dhol. All rights reserved.
//
import UIKit
class AppIconChangeController: UIViewController {
//
// SettingsViewController.swift
// ColorPicker
//
// Created by Swapnanil Dhol on 9/13/19.
// Copyright © 2019 Swapnanil Dhol. All rights reserved.
//
import UIKit
import TipJarViewController
import SafariServices
@SwapnanilDhol
SwapnanilDhol / viewDidLoad.swift
Last active February 23, 2020 09:22
DeviceType
guard let type = UIDevice.current.deviceType else {return}
print(type)
@SwapnanilDhol
SwapnanilDhol / UIDeviceExtension.swift
Created February 23, 2020 09:18
UIDeviceExtension
extension UIDevice
{
var deviceType: DeviceType? {
#if targetEnvironment(macCatalyst)
return .mac
#else
switch UIDevice.current.userInterfaceIdiom
{
case .phone:
@SwapnanilDhol
SwapnanilDhol / deviceTypeEnum.swift
Last active February 23, 2020 09:15
Device Type Enum
enum DeviceType
{
case phone
case pad
case mac
}