Add the following to your ~/.bashrc
:
alias g='git'
// The SwiftUI Lab | |
// Website: https://swiftui-lab.com | |
// Article: https://swiftui-lab.com/alignment-guides | |
import SwiftUI | |
class Model: ObservableObject { | |
@Published var minimumContainer = true | |
@Published var extendedTouchBar = false | |
@Published var twoPhases = true |
// Custom Date Decoding | |
jsonDecoder.dateDecodingStrategy = .custom({ (decoder) -> Date in | |
let data = try decoder.singleValueContainer().decode(String.self) | |
//perform your operation on obtained string | |
let disturbance = "01-07-1977" | |
let formatter = DateFormatter() | |
formatter.dateFormat = "dd-MM-yyyy" | |
if data == "First disturbance in force" { | |
return formatter.date(from: disturbance) ?? Date() | |
} else { |
Copyright (c) 2017 Jordan Cole | |
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: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O |
// | |
// ViewController.swift | |
// | |
// Technical Q&A QA1702 | |
// How to capture video frames from the camera as images using AV Foundation on iOS | |
// | |
import UIKit | |
import AVFoundation | |
import CoreMedia |
extension UIViewController { | |
func topMostViewController() -> UIViewController { | |
if self.presentedViewController == nil { | |
return self | |
} | |
if let navigation = self.presentedViewController as? UINavigationController { | |
return navigation.visibleViewController.topMostViewController() | |
} | |
if let tab = self.presentedViewController as? UITabBarController { | |
if let selectedTab = tab.selectedViewController { |
import Foundation | |
extension String { | |
public func split(separator: String) -> [String] { | |
if separator.isEmpty { | |
return map(self) { String($0) } | |
} | |
if var pre = self.rangeOfString(separator) { | |
var parts = [self.substringToIndex(pre.startIndex)] | |
while let rng = self.rangeOfString(separator, range: pre.endIndex..<endIndex) { |
// Obtain a SurfaceView. | |
// SurfaceView surfaceView = (SurfaceView)findViewById(R.id.surfaceView1); | |
Canvas canvas = surfaceView.getHolder().lockCanvas(); | |
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); | |
// Draw someting | |
surfaceView.getHolder().unlockCanvasAndPost(canvas); |
using UnityEngine; | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
[Serializable] | |
public class EchoSphere2 { | |
public enum ShaderPackingMode { Texture, Property }; | |
public ShaderPackingMode CurrentPackingMode = ShaderPackingMode.Texture; | |