Skip to content

Instantly share code, notes, and snippets.

View DroidFxGit's full-sized avatar
🍎
Enjoy coding

Carlos Vázquez G. DroidFxGit

🍎
Enjoy coding
  • Ualá
  • Mexico City
View GitHub Profile
@mminer
mminer / Alamofire+Rx.swift
Created January 6, 2017 21:11
Example of Alamofire RxSwift response serialization extension.
import Alamofire
import RxSwift
extension Request: ReactiveCompatible {}
extension Reactive where Base: DataRequest {
func responseJSON() -> Observable<Any> {
return Observable.create { observer in
let request = self.base.responseJSON { response in
@nor0x
nor0x / shadow+cornerradius.swift
Created December 22, 2016 17:23
UICollectionViewCell -> Corner Radius AND Shadow
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
cell.contentView.layer.cornerRadius = 2.0
cell.contentView.layer.borderWidth = 1.0
cell.contentView.layer.borderColor = UIColor.clear.cgColor
cell.contentView.layer.masksToBounds = true;
cell.layer.shadowColor = UIColor.lightGray.cgColor
cell.layer.shadowOffset = CGSize(width:0,height: 2.0)
cell.layer.shadowRadius = 2.0
cell.layer.shadowOpacity = 1.0
@carlynorama
carlynorama / dictionary_sorting.swift
Last active April 10, 2021 04:31
One line sorting of dictionaries Swift 2.1, both by key and by value examples.
let myDictionary = [
"20" : "banna",
"60" : "apple",
"30" : "cucumber",
"10" : "starfruit"
]
//assume that sort() kinda takes 2 arguments i.e. sort(dictionary element a, dictionary element b)
//woriking its way down the array (http://www.sorting-algorithms.com/bubble-sort)
//compare the 0th assumed parameter(a) with the 1st assumed parameter (b), using the key (0 after decimal)
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing