Skip to content

Instantly share code, notes, and snippets.

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

Milan miff Djordjevic miff

🏠
Working from home
View GitHub Profile
import SwiftUI
struct AnimatedButtonView: View {
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
let duration = 3
@State private var timerValue = 3
@State private var progress: CGFloat = 0
@State private var isRunning = false
var body: some View {
extension XCTestCase {
func assertDeallocation<T: AnyObject>(of object: () -> T, file: StaticString = #file, line: UInt = #line) {
weak var weakReferenceToObject: T?
let autoreleasepoolExpectation = expectation(description: "Autoreleasepool drain")
autoreleasepool {
let object = object()
weakReferenceToObject = object
XCTAssertNotNil(weakReferenceToObject)
autoreleasepoolExpectation.fulfill()
@miff
miff / Example.http
Created July 11, 2023 18:42
Example of http file
### SIGN IN
POST https://example.com/auth/signin
content-type: application/json
{
"email": "miff@iomc.rs",
"password": "xxxxxx"
}
// Don't forget to add to the project:
// 1. DeepLabV3 - https://developer.apple.com/machine-learning/models/
// 2. CoreMLHelpers - https://github.com/hollance/CoreMLHelpers
enum RemoveBackroundResult {
case background
case finalImage
}
extension UIImage {
@miff
miff / ngresources.sh
Created May 21, 2023 12:51
Generates resources for angular
#! /bin/bash
RED="\033[31m"
BLUE="\033[34m"
GREEN="\033[32m"
YELLOW="\033[33m"
ENDCOLOR="\033[0m"
ANGULARJSON=$1/angular.json
if test -f "$ANGULARJSON"; then
@miff
miff / CustomComposition.swift
Created May 19, 2021 18:57
Custom Composition example
import AVFoundation
import Foundation
import UIKit
class CustomComposition: NSObject, AVVideoCompositing {
var sourcePixelBufferAttributes: [String : Any]? {
get {
return ["\(kCVPixelBufferPixelFormatTypeKey)": kCVPixelFormatType_32BGRA]
}
@miff
miff / runscript.sh
Created April 4, 2021 13:07
Build Script in XCode
// In Targets -> Build Phases -> Add Run Script
TAGS="TODO:|FIXME:"
ERRORTAG="ERROR:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$|($ERRORTAG).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" | perl -p -e "s/($ERRORTAG)/ error: \$1/"
from flask import Flask
from flask_restful import Api, Resource, reqparse
app = Flask(__name__)
api = Api(app)
users = [
{
"name": "Nicholas",
"age": 42,
Luqman Donald (Ostriches FC) steals the ball
Arman Sharples (Caring Spiders) scores
Raphael Mullen (Ostriches FC) scores
Connagh Daniels (Ostriches FC) steals the ball
Stan Hines (Ostriches FC) scores
Kamal Lutz (Caring Spiders) score a beatufull goal from 40 m
Jorge Oneil (Ostriches FC) stops the ball!
Kamal Lutz (Caring Spiders) passes a ball!
Hamza Burton (Caring Spiders) steals the ball
Raphael Mullen (Ostriches FC) passes a ball!
import UIKit
import AVKit
import AVFoundation
protocol VideViewDelegate {
func didEndVideo()
}
class VideoView: UIView {