Function | Shortcut |
---|---|
New Tab | ⌘ + T |
Close Tab or Window | ⌘ + W (same as many mac apps) |
Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Cycle iTerm Windows | ⌘ + backtick (true of all mac apps and works with desktops/mission control) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
func unique<T:Hashable>(by: ((Element) -> (T))) -> [Element] { | |
var set = Set<T>() //Keep unique list in a Set for fast retrieval | |
var orderedArray = [Element]() //Keeping the unique list of elements but ordered | |
for value in self { | |
if !set.contains(by(value)) { | |
set.insert(by(value)) | |
orderedArray.append(value) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class SignaturePainter extends CustomPainter { | |
SignaturePainter(this.points); | |
final List<Offset> points; | |
void paint(Canvas canvas, Size size) { | |
Paint paint = new Paint() | |
..color = Colors.black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static String timeAgoSinceDate(String dateString, {bool numericDates = true}) { | |
DateTime date = DateTime.parse(dateString); | |
final date2 = DateTime.now(); | |
final difference = date2.difference(date); | |
if ((difference.inDays / 365).floor() >= 2) { | |
return '${(difference.inDays / 365).floor()} years ago'; | |
} else if ((difference.inDays / 365).floor() >= 1) { | |
return (numericDates) ? '1 year ago' : 'Last year'; | |
} else if ((difference.inDays / 30).floor() >= 2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get memory address of value type | |
func address(of value: UnsafeRawPointer) -> Int { | |
return unsafeBitCast(value, to: Int.self) | |
} | |
var num1 = 55 | |
var num2 = 55 | |
print(NSString(format: "%p", address(of:&num1))) // -> "0x11fc3c5a0" | |
print(NSString(format: "%p", address(of:&num2))) // -> "0x11fc3c5a8" | |
num2 = 77 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum VersionError: Error { | |
case invalidResponse, invalidBundleInfo | |
} | |
class ForceUpdateAppVersion { | |
class func isForceUpdateRequire(apiVersion:Int) -> Bool { | |
func update() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension TimeInterval { | |
struct DateComponents { | |
static let formatterPositional: DateComponentsFormatter = { | |
let formatter = DateComponentsFormatter() | |
formatter.allowedUnits = [.hour,.minute,.second] | |
formatter.unitsStyle = .positional | |
formatter.zeroFormattingBehavior = .pad | |
return formatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard let urlEncodedString = (AppConstants.URL.sendDeviceTokekn).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { | |
return | |
} | |
let url = URL(string: urlEncodedString)! | |
let urlRequest = NSMutableURLRequest(url: url, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 60.0) | |
urlRequest.setValue("Application/json", forHTTPHeaderField: "Content-Type") | |
urlRequest.setValue("Application/json", forHTTPHeaderField: "Accept") | |
urlRequest.httpMethod = "POST" | |
let params: [String : Any] = ["txDeviceToken":token, "tDeviceOs":2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ImageResponse: Codable { | |
var message:String | |
var totalRecord:Int | |
var totalPage:Int | |
var nextPage:String | |
var images:[Image] | |
enum CodingKeys: String, CodingKey { | |
case message | |
case totalRecord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FormViewSocial.swift | |
// SwiftUI_Practice | |
// | |
// Created by Dinesh Kachhot on 05/03/20. | |
// Copyright © 2020 KD. All rights reserved. | |
// | |
import SwiftUI |
OlderNewer