Skip to content

Instantly share code, notes, and snippets.

View richimf's full-sized avatar
:octocat:
Coding...

Ricardo Montesinos richimf

:octocat:
Coding...
View GitHub Profile
import UIKit
class ImageDownloader {
// DOWNLOAD IMAGE METHOD
func loadImage(of from: URL, completion: @escaping () -> Void ) -> UIImage {
let size = CGSize(width: 100, height: 140)
// Download and Compress image to fit container size
DispatchQueue.global(qos: .background).async {
guard let newimage = self.downloadAndCompress(url: url, newSize: size) else { return }
@richimf
richimf / clearDerivedData.sh
Created October 9, 2019 03:22
Clear Derived Data
#!/bin/bash
# cd /usr/local/bin
echo "Clearing Derived Data"
rm -rf /Users/<MyUserName>/Library/Developer/Xcode/DerivedData
echo "Done"
@richimf
richimf / users.json
Last active December 11, 2019 18:17
users json
{
"data" : "some data"
}
@richimf
richimf / file.json
Last active December 11, 2019 18:38
{
"firstName": "Name",
"lastName": "LastName",
"age": 10,
"address":
{
"streetAddress": "Reforma",
"city": "Mexico",
"state": "CDMX",
"postalCode": "00600"
@richimf
richimf / albums.json
Created December 13, 2019 19:02
albums json
[
{
"album": "Dark side of the moon",
"year": "1927",
"cover": "https://upload.wikimedia.org/wikipedia/en/3/3b/Dark_Side_of_the_Moon.png",
"genre": "Pop"
},
{
"album": "Love letters",
"year": "2014",
@richimf
richimf / data.json
Last active December 23, 2019 23:00
JSON sesion 6 reto 3
{
"animals": [
{
"id": 1,
"name": "Cat",
"type": "cat",
"weight": 23,
"area": ["home", "street"],
"can_climb_trees": true,
"competence": [
@richimf
richimf / rx.swift
Created February 20, 2020 00:15
RxSwift Cheat Sheet
//
//let episodeV = "episodeV"
//
//example(of: "Creating observables") {
// let mostPopular: Observable<String> = Observable<String>.just(episodeV)
//}
import RxSwift
// MARK: OBSERVABLES
/**
@richimf
richimf / gist:ad5b3b6b344aa45e6ac2c8ba487a4f27
Created March 3, 2020 19:50
How to Pod specific commit
pod 'Auth0', :git => 'https://github.com/auth0/Auth0.swift.git', :commit => 'e399d67a57b80879947682807c20419bc8af9dad'
@richimf
richimf / HomeCustomLayout.swift
Created March 24, 2020 15:14
CollectionView Custom Layout
import UIKit
enum CollectionDisplay {
case list
case twoColumns
}
class HomeCustomLayout: c {
import UIKit
class CustomView: UIView {
//Override the init() constructor so that you can call the function loadView()
override init(frame: CGRect) {
super.init(frame: frame)
loadView()
}