Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Rita popcornomnom

:octocat:
View GitHub Profile
@kboy-silvergym
kboy-silvergym / SnapLikePageViewController.swift
Last active Nov 14, 2019
Snapchat like PageViewController which is changing its alpha of background color as scrolling.
View SnapLikePageViewController.swift
import UIKit
enum TutorialNumber {
case first
case second
}
protocol TutorialVC: class {
var number: TutorialNumber { get set }
}
View OptionalChaining.swift
let a: Double? = 1.0
let b: Double? = 2.0
let c: Double? = 3.0
let d: Double? = 4.0
let e: Double? = 5.0
let f: Double? = 6.0
let g: Double? = 7.0
extension Optional {
func `or`(_ value : Wrapped?) -> Optional {
@laurilehmijoki
laurilehmijoki / keyboardHeightObservable.swift
Last active Nov 18, 2020
RxSwift Observable on iOS keyboard height
View keyboardHeightObservable.swift
import RxSwift // Version 3.2.0
import RxCocoa // Version 3.2.0
func keyboardHeight() -> Observable<CGFloat> {
return Observable
.from([
NotificationCenter.default.rx.notification(NSNotification.Name.UIKeyboardWillShow)
.map { notification -> CGFloat in
(notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
},
@wojteklu
wojteklu / clean_code.md
Last active Nov 26, 2020
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

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

@Fluidbyte
Fluidbyte / Common-Currency.json
Last active Nov 26, 2020
Common Currency Codes in JSON
View Common-Currency.json
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
You can’t perform that action at this time.