Skip to content

Instantly share code, notes, and snippets.

View Tigorn's full-sized avatar
💭
Persistence and determination

Igor Tigorn

💭
Persistence and determination
View GitHub Profile
@Tigorn
Tigorn / AnimatedVoronoiFlowGradient.swift
Created August 19, 2024 21:58 — forked from eleev/AnimatedVoronoiFlowGradient.swift
Animated Voronoi Flow Gradient
//
// VoronoiFlowGradient and the related sources
// Copyright (c) 2024 Astemir Eleev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@Tigorn
Tigorn / CheckDaysStreak.swift
Created December 28, 2023 21:55 — forked from eugenezuban/CheckDaysStreak.swift
A function to help you get the longest contiguous sequence of days from an array of dates. For example, can be used in the habit tracker.
func checkStreak(of dateArray: [Date]) -> Int{
let dates = dateArray.sorted()
// Check if the array contains more than 0 dates, otherwise return 0
guard dates.count > 0 else { return 0 }
// Get full day value of first date in array
let referenceDate = Calendar.current.startOfDay(for: dates.first!)
// Get an array of (non-decreasing) integers
let dayDiffs = dates.map { (date) -> Int in
Calendar.current.dateComponents([.day], from: referenceDate, to: date).day!
}
@Tigorn
Tigorn / Calendar.swift
Created December 22, 2023 12:18 — forked from mecid/Calendar.swift
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)
@Tigorn
Tigorn / ios-font-sizes.swift
Created December 19, 2023 09:22 — forked from zacwest/ios-font-sizes.swift
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]
@Tigorn
Tigorn / ContentView.swift
Created July 31, 2023 15:00 — forked from dkun7944/ContentView.swift
AirDrop iOS 17 Swift.Shader Animation
//
// ContentView.swift
// Airdrop Demo
//
// Created by Daniel Kuntz on 7/30/23.
//
import SwiftUI
struct ContentView: View {
import notify
import Combine
enum Notify {}
extension Notify {
struct Status: Error {
let rawValue: UInt32
init(_ rawValue: UInt32) {
self.rawValue = rawValue
@Tigorn
Tigorn / postgres-brew.md
Created September 13, 2022 12:15 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@Tigorn
Tigorn / resetXcode.sh
Created February 14, 2022 21:19 — forked from maciekish/resetXcode.sh
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
@Tigorn
Tigorn / NSDateFormatter cheat sheet
Created March 30, 2021 20:37 — forked from romaonthego/NSDateFormatter cheat sheet
Date Formats for NSDateFormatter
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)
@Tigorn
Tigorn / SomeCollectionViewCell.swift
Last active July 31, 2020 08:13
Animate cell when pressed
//MARK:- Events
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
animate(isHighlighted: true)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
animate(isHighlighted: false)
}