This file contains hidden or 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
render :edit | |
render action: :edit | |
render "edit" | |
render "edit.html.erb" | |
render action: "edit" | |
render action: "edit.html.erb" | |
render "books/edit" | |
render "books/edit.html.erb" | |
render template: "books/edit" | |
render template: "books/edit.html.erb" |
This file contains hidden or 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
__weak __typeof(self) weakSelf = self; | |
[self doSomeThingWithBlock:^(void) { | |
if (weakSelf) { | |
__strong __typeof(weakSelf) strongSelf = weakSelf; | |
strongSelf.someProperty = someValue; | |
[strongSelf performSomeMethod]; | |
} | |
}]; |
This file contains hidden or 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
###show all envirement variables | |
xcodebuild -workspace appname.xcworkspace -scheme scheme -showBuildSettings | |
xcodebuild -project appname.xcproj -target target -showBuildSettings |
This file contains hidden or 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
// copy from https://www.craftappco.com/blog/2018/5/30/simple-throttling-in-swift | |
class Throttler { | |
private var workItem: DispatchWorkItem = DispatchWorkItem(block: {}) | |
private var previousRun: Date = Date.distantPast | |
private let queue: DispatchQueue | |
private let minimumDelay: TimeInterval | |
init(minimumDelay: TimeInterval, queue: DispatchQueue = DispatchQueue.main) { | |
self.minimumDelay = minimumDelay |
This file contains hidden or 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 UIView { | |
/** | |
* Set aspect ratio for self | |
* | |
* Examples: there is a view `v` | |
* v.aspectRatio(ratio: 2.0) | |
*/ | |
public func aspectRatio(ratio: CGFloat) { | |
self.translatesAutoresizingMaskIntoConstraints = false |
This file contains hidden or 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
// | |
// Logger.swift | |
// | |
// Created by on 24.01.20. | |
// | |
import Foundation | |
import os.log | |
public struct Logger { |
This file contains hidden or 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
### Print swift object at address | |
`e -l swift -O -- 0xaddress` | |
### print ObjectivC object at address | |
`e -l objc -O -- 0xaddress` |
OlderNewer