Skip to content

Instantly share code, notes, and snippets.

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

Nikhil Nigade dezinezync

🏠
Working from home
View GitHub Profile
@dezinezync
dezinezync / sync.swift
Created April 12, 2024 06:47
Sync Operation Example
final class SyncOperation: OperationSuperclass {
public override func run() {
print("Sync has started")
Task { [weak self] in
guard let self else {
return
}
do {
@dezinezync
dezinezync / holidays2024.ics
Last active March 16, 2024 15:39
Holidays(2024) ICS - Fixed. Derived from: https://www.india.gov.in/calendar/2024/export.ics
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Date iCal//NONSGML kigkonsult.se iCalcreator 2.20.2//
METHOD:PUBLISH
X-WR-CALNAME;VALUE=TEXT:Holiday Calendar
BEGIN:VTIMEZONE
TZID:Asia/Kolkata
BEGIN:STANDARD
DTSTART:19451015T000000
TZOFFSETFROM:+0630
@dezinezync
dezinezync / DZShadowsView.swift
Last active December 5, 2023 07:36
DZShadowsView
//
// DZShadowsView.swift
//
//
// Created by Nikhil Nigade on 16/12/21.
//
#if !os(watchOS)
#if os(iOS)
@dezinezync
dezinezync / vapor.fluent.mysql.md
Last active October 7, 2023 03:23
Vapor-Fluent with MySQL: incorrect character set used

Base Query

SELECT * FROM performance_schema.session_variables
WHERE VARIABLE_NAME IN (
 'character_set_client', 'character_set_connection',
 'character_set_results', 'collation_connection'
) ORDER BY VARIABLE_NAME;

Sequel Pro

@dezinezync
dezinezync / dribbble.less
Created June 22, 2023 13:57
Dribbble Dark Mode
@media (prefers-color-scheme: dark) {
body {
background: #101010;
}
.psst {
display: none;
overflow: hidden;
margin: -1;
}
@dezinezync
dezinezync / MapKitExtensions.swift
Last active September 28, 2021 11:15 — forked from dionc/MapKitExtensions.swift
Create an MKCoordinateRegion from an array of coordinates. Safely handles coordinates that cross the 180th meridian.
import MapKit
extension MKCoordinateRegion {
init?(coordinates: [CLLocationCoordinate2D]) {
// first create a region centered around the prime meridian
let primeRegion = MKCoordinateRegion.region(for: coordinates, transform: { $0 }, inverseTransform: { $0 })
// next create a region centered around the 180th meridian
@dezinezync
dezinezync / fastfile.rb
Created August 20, 2021 02:46
Build a macOS App and notarize it using Fastlane
default_platform(:mac)
platform :mac do
before_all do
# Make sure we start off with a clean slate
ensure_git_status_clean
end
desc "Create a notarized build of the macOS App"
lane :notarized do
@dezinezync
dezinezync / Some.swift
Created July 28, 2021 06:05
Xcode 13 Beta 3 and above: Workaround for UIApplication usage in SPM packages
private func someFunc() -> Bool {
guard let aClass = NSClassFromString("UIApplication") else {
return false
}
// fetch properties as necessary.
let layoutDirection = UIUserInterfaceLayoutDirection(rawValue: aClass.value(forKeyPath: "sharedApplication.userInterfaceLayoutDirection") as! Int)
// use runtime inspection to determine return value type.
let state = UIApplication.State(rawValue: aClass.value(forKeyPath: "sharedApplication.applicationState") as! Int)
@dezinezync
dezinezync / UIButton+Catalyst.swift
Last active November 8, 2021 05:56
UIButton additions for macCatalyst
//
// UIButton+Catalyst.swift
// Elytra
//
// Created by Nikhil Nigade on 09/07/21.
// Copyright © 2021 Dezine Zync Studios. All rights reserved.
//
import UIKit
@dezinezync
dezinezync / apple trailers
Created April 11, 2021 03:01
apple trailers
http://trailers.apple.com/trailers/home/feeds/studios/fox.json
http://trailers.apple.com/trailers/feeds/data/17602.json
http://trailers.apple.com/trailers/feeds/data/18029.json
<meta name="apple-itunes-app" content="app-id=471966214, app-argument=movietrailers://movie/detail/18029">
http://trailers.apple.com/trailers/disney/pirates-of-the-caribbean-dead-men-tell-no-tales/images/poster.jpg
http://trailers.apple.com/trailers/disney/pirates-of-the-caribbean-dead-men-tell-no-tales/images/poster_2x.jpg