Skip to content

Instantly share code, notes, and snippets.

View amrangry's full-sized avatar
🎯
Focusing

Amr Elghadban amrangry

🎯
Focusing
View GitHub Profile
@amrangry
amrangry / clean_code.md
Created June 24, 2020 07:58 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

//
// ValueWrapper.swift
// ADKATech.com
//
// Created by Amr Elghadban on 9/20/18.
// Copyright © 2018 Mobile DevOps. All rights reserved.
//
import Foundation
@amrangry
amrangry / UserDefaultsManager.swift
Last active February 5, 2024 17:19
UserDefaultsManager is a manager and wrapper class for UserDefaults
//
// UserDefaultsManager.swift
// Www.ADKATech.com
//
// Created by AmrAngry on 7/30/19.
// Modifyed by AmrAngry on 5/5/20.
// Copyright © 2019 Www.ADKATech.com. All rights reserved.
// Generic use original mestion by (FB)محمود زكى and hamada147(Github)
import Foundation
@amrangry
amrangry / SoundPlayer.swift
Last active April 12, 2020 08:58
A SoundPlayer is a handler controller object used to manage the playback of a media asset which You can use to play media assets
//
// SoundPlayer.swift
// Logistics
//
// Created by AmrAngry on 26/02/2020.
// Copyright © 2020 ADKATech.com All rights reserved.
// A SoundPlayer is a handler controller object used to manage the playback of a media asset which You can use to play media assets
// https://gist.github.com/amrangry/e1a889c005b5a3e52a5724b05aa6a7b9
import Foundation
class func addRealstate(city_id:Int,realstate_type:String,category_id:Int,name:String,price:String,latitude:String,longitude:String,content:String,mobile:String,photos:[UIImage]?,state:String , completionHandler : @escaping (_ isSuccess: Bool ,_ message:String)-> Void) {
guard let user = User.currentUser().user else {
return
}
let parameters : Parameters = [
"city_id" : "\(city_id)" , "realstate_type" : realstate_type , "category_id" : "\(category_id)" , "name" : name , "price" : price , "latitude" : latitude , "longitude" : longitude,"content" : content ,"mobile" : mobile,"state" : state
]
class func editProfile(name:String , email:String , mobile:String , city_id : Int , password:String , passwordConfirmation:String , logo : UIImage , completionHandler :@escaping (_ isSuccess:Bool , _ message:String , _ user : User?)->Void){
guard let user = User.currentUser().user else {
return
}
let parameters : Parameters = [
"email" : email , "password" : password , "name" : name , "password_confirmation" : passwordConfirmation , "mobile" : mobile , "city_id" : "\(city_id)"
]
let imageData = UIImagePNGRepresentation(image)
let base64String = imageData?.base64EncodedString()
let params = "access_key=Hnc40Wqqa4E2dcAAwx3Eql1q&access_password=Mnaslk53asQAs52Ec00Xssaw852ASs36&imageData=\(base64String)"
@amrangry
amrangry / DataTask.swift
Created March 20, 2017 08:29
this file is aiming to use URLSession to make a web service api call using swift 3
//
// DataTask.swift
//
//
// Created by Amr AlGhadban on 2/15/17.
// Copyright © 2017 Amr AlGhadban. All rights reserved.
//
import Foundation