Skip to content

Instantly share code, notes, and snippets.

View amrangry's full-sized avatar
🎯
Focusing

Amr Elghadban amrangry

🎯
Focusing
View GitHub Profile
@initFabian
initFabian / AlamofireRouterExample_Extended.swift
Last active June 6, 2020 15:27
An Alamofire router example used in a post, https://chaione.com/blog/rethinking-routers-swift-protocol-oriented-programming-part-1, to show how a router with multiple paths would look like.
// Router.swift
import Alamofire
enum Router: URLRequestConvertible {
static let baseURLString = "https://private-85a46-routable.apiary-mock.com/"
case readUsers
case createUser(parameters: Parameters)
@wojteklu
wojteklu / clean_code.md
Last active June 18, 2024 15:19
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

@niraj-shah
niraj-shah / eid_regex.php
Last active February 4, 2022 09:46
PHP Regex to validate Emirates ID number
<?php
/**
* Regex example to validate the format of a Emirates
* ID number. Does not validate the checkbit (Luhn Algorithm).
*
* @author Niraj Shah <niraj@webniraj.com>
*/
// regex to validate the format xxx-xxxx-xxxxxxx-x (Emirates ID)
internal let DEFAULT_MIME_TYPE = "application/octet-stream"
internal let mimeTypes = [
"html": "text/html",
"htm": "text/html",
"shtml": "text/html",
"css": "text/css",
"xml": "text/xml",
"gif": "image/gif",
"jpeg": "image/jpeg",