Skip to content

Instantly share code, notes, and snippets.

@megimix
megimix / UIImageView+topAlignmentAndAspectFit
Last active June 14, 2022 09:01
UIImageView with Aspect Fit and Alignment To Top. thanks to (http://stackoverflow.com/a/27569222/1267174)
extension UIImageView {
func topAlignmentAndAspectFit(to view: UIView) {
self.contentMode = .scaleAspectFill
self.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(self)
self.addConstraints(
[NSLayoutConstraint(item: self,
attribute: .height,
relatedBy: .equal,
@megimix
megimix / git_checkout_reset_hard.rb
Created February 21, 2017 17:04
Fastlane Action for resetting git branch to remote
module Fastlane
module Actions
module SharedValues
GIT_CHECKOUT_BRANCH_AND_RESET = :GIT_CHECKOUT_BRANCH_AND_RESET
end
class GitCheckoutResetHardAction < Action
def self.run(params)
remote_branch = params[:remote_branch]
Actions.sh("git fetch")
// Last active bace on nsdate
+ (NSString * __nonnull)sellerLastActiveStringWithSellerLastActivDate:(NSDate * __nullable)sellerLastActive
isSellerOnline:(BOOL)isSellerOnline {
NSString *timeString = @"";
if (sellerLastActive == nil) {
//do nothing
}
else if (isSellerOnline) {
timeString = @"Online";
}