$ git branch | fzf
$ git switch $(git branch | fzf)
$ git checkout $(git for-each-ref refs/heads/ --format='%(refname:short)' | fzf)
Or add below script to .zshrc
// Swift4 | |
let image = UIImage(named: "sample") | |
let data = image?.pngData() | |
let data = image?.jpegData(compressionQuality: 0.9) | |
let uiImage: UIImage = UIImage(data: imageData) | |
// deprecated | |
// var imageData: Data = UIImagePNGRepresentation(image) |
@dynamicMemberLookup | |
public struct Builder<Base> { | |
public var build: () -> Base | |
public init(_ build: @escaping () -> Base) { | |
self.build = build | |
} | |
public init(_ base: Base) { |
import AVFoundation | |
import os.log | |
/// https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/05_Export.html | |
/** | |
Steps | |
- Use serialization queues to handle the asynchronous nature of reading and writing audiovisual data | |
- Initialize an asset reader and configure two asset reader outputs, one for audio and one for video | |
- Initialize an asset writer and configure two asset writer inputs, one for audio and one for video |
//: [Table of Contents](Table%20of%20Contents) | [Next](@next) | |
import Foundation | |
/*: | |
## Number Formatter | |
Provides localized representations of units and measurements. | |
*/ | |
let numberFormatter = NumberFormatter() |
class PhotoCapture { | |
// here some stuff for capture image, such as capture session, configurations, photo output | |
// More detail : https://github.com/trilliwon/ArtCamera/blob/master/Camera/Controllers/PhotoCapture.swift | |
} | |
// MARK: - AVCapturePhotoCaptureDelegate | |
extension PhotoCapture: AVCapturePhotoCaptureDelegate { | |
func photoOutput(_ output: AVCapturePhotoOutput, willCapturePhotoFor resolvedSettings: AVCaptureResolvedPhotoSettings) { | |
AudioServicesDisposeSystemSoundID(1108) | |
} |
$ git branch | fzf
$ git switch $(git branch | fzf)
$ git checkout $(git for-each-ref refs/heads/ --format='%(refname:short)' | fzf)
Or add below script to .zshrc
// | |
// Created by はるふ on 2017/12/11. | |
// Copyright © 2017年 ha1f. All rights reserved. | |
// | |
import Foundation | |
import CoreImage | |
import AVFoundation | |
extension CIFilter { |
import Foundation | |
@dynamicMemberLookup | |
public struct Builder<Base: AnyObject> { | |
let _build: () -> Base | |
public init(_ build: @escaping () -> Base) { | |
self._build = build |
#!/bin/sh | |
echo "generating I18N.swift" | |
touch tempI18N.swift | |
echo "struct I18N {" >> tempI18N.swift | |
inputfile=${SRCROOT}/Pomodoro/Resources/en.lproj/Localizable.strings | |
while IFS= read -r line |
// String to Data utf8 | |
let strData: Data = Data("String".utf8) | |
// Data to String | |
let str = String(data: strData, encoding: .utf8) |