Skip to content

Instantly share code, notes, and snippets.

View glennposadas's full-sized avatar
🏠
Working from home

Glenn Posadas glennposadas

🏠
Working from home
View GitHub Profile
Given we must unit test the function in ClassToTest, how would you change the code below to allow us to achieve this?
Notes:
These will be unit tests so must work offline (ie does not rely on the API)
No need to write the tests, we just how we could change the code to make it testable.
We can't use any third party mocking libraries
Feel free to write your answer as text or pseudocode
class API {
func fetchItems(completion: (Result<[Item], Error>) -> Void) {
@glennposadas
glennposadas / VerticleButton+UnderlineView.swift
Created June 23, 2022 09:08
Vertical button with underline view
//
// ViewController.swift
// Button
//
// Created by Glenn Posadas on 6/23/22.
//
import UIKit
class ViewController: UIViewController {
import UIKit
class ViewController: UIViewController {
var button: VerticalButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
@glennposadas
glennposadas / semaphore-dispatchgroup.swift
Last active May 12, 2022 14:18
semaphore+dispatchGroup+swift
//
// ViewController.swift
// semap
//
// Created by Glenn Posadas on 5/10/22.
//
import UIKit
class ViewController: UIViewController {
@glennposadas
glennposadas / semaphore.swift
Last active May 9, 2022 18:56
semaphore-swift
//
// ViewController.swift
// semap
//
// Created by Glenn Posadas on 5/10/22.
//
import UIKit
@glennposadas
glennposadas / auto-migrate-sequelize-from-models.md
Created May 22, 2020 11:15
How to auto generate migrations with Sequelize CLI from Sequelize models?

Reference: https://stackoverflow.com/a/59021807/3231194

It's 2020 and many of these answers no longer apply to the Sequelize v4/v5 ecosystem.

The one good answer says to use sequelize-auto-migrations, but probably is not prescriptive enough to use in your project. So here's a bit more color...

Setup

My team uses a [fork of sequelize-auto-migrations][1] because the original repo is has not been merged a few critical PRs. [#56][2] [#57][3] [#58][4] [#59][5]

Keybase proof

I hereby claim:

  • I am glennposadas on github.
  • I am glennposadas (https://keybase.io/glennposadas) on keybase.
  • I have a public key ASBwTBSj7XpRuNX1ZkuMF5gY36_x6ln4qrp_gUAFoG-7_wo

To claim this, I am signing this object:

//
// ViewController.swift
// TestNavigation
//
// Created by Glenn Von C. Posadas on 11/11/2018.
// Copyright © 2018 Glenn Von C. Posadas. All rights reserved.
//
import UIKit
@glennposadas
glennposadas / SVProgressHUD+FindWork.swift
Created September 9, 2017 18:43
SVProgressHUD Extension
//
// SVProgressHUD+FindWork.swift
// FindWork
//
// Created by Glenn Posadas on 1/20/17.
// Copyright © 2017 ThirtyOneDigital. All rights reserved.
//
import SVProgressHUD
import UIKit
@glennposadas
glennposadas / DataSourceSample.playground
Created July 27, 2017 15:42
A playground file that contains an example of making a protocol datasource in Swift.
//: Playground - noun: a place where people can play
import UIKit
// DATA SOURCE EXAMPLE:
/** This MyViewDataSource protocol is just like the UITableViewDataSource
*/
protocol MyViewDataSource {
func increment(count: Int) -> Int