Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
struct ContentView: View {
private static let formatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .short
formatter.timeStyle = .short
return formatter
}()
let likes: UInt = 10
#!/bin/sh
start_time=0:0
duration=35
ffmpeg -i $1 -vf palettegen palette.png
palette="./palette.png"
filters="fps=15,scale=320:-1:flags=lanczos"
ffmpeg -v warning -ss $start_time -t $duration -i $1 -vf "$filters,palettegen" -y $palette
for i in *.avi;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" "${name}.mov"
done
@prafullakumar
prafullakumar / clock.swift
Created May 31, 2020 15:41
SwiftUI - Analog Clock
import SwiftUI
import Combine
struct ClockTickerModel {
enum TickerType {
case second
case hour
case minute
}
let type: TickerType
import SwiftUI
import Combine
final class CurrentTime: ObservableObject {
@Published var seconds: TimeInterval = CurrentTime.currentSecond(date: Date())
private let timer = Timer.publish(every: 0.2, on: .main, in: .default).autoconnect()
private var store = Set<AnyCancellable>()
import SwiftUI
import Combine
struct ClockTickerModel {
enum TickerType {
case second
case hour
case minute
}
let type: TickerType
import SwiftUI
import Combine
struct ContentView: View {
func tick(at tick: Int) -> some View {
VStack {
Rectangle()
.fill(Color.primary)
.opacity(tick % 5 == 0 ? 1 : 0.4)
extension Color {
static var theme: Color {
return Color("theme")
}
static var error: Color {
return Color("error")
}
import Foundation
import CoreGraphics
class Matrix {
static let headerPrimarySize: CGFloat = 36
static let headerSecondarySize: CGFloat = 27
static let paragraphSize: CGFloat = 18
static let stackViewSpacing: CGFloat = 20
static let cornerRadius: CGFloat = 12
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).