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
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("RootViewController") as! RootViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
let sideNavigationController = SideNavigationController(rootViewController: rootViewController, leftViewController: sideViewController)
// Configure the window with the SideNavigationController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("RootViewController") as! RootViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
// Add a navigation controller to our main screen
var rootNavCon = RootNavigationController(rootViewController: rootViewController)
rootNavCon = storyboard.instantiateViewControllerWithIdentifier("RootNavigationController") as! RootNavigationController
@glennposadas
glennposadas / sendmailcore2objc.m
Last active March 4, 2021 00:10
Sample full code of sending an email using MailCore2 in Objective-C
- (IBAction)sendEmail:(id)sender {
MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
MCOAddress *address = [MCOAddress addressWithDisplayName:@"Uplant Support" mailbox:@"noreply.uplant@gmail.com"];
NSArray *to = [NSArray arrayWithObject:[MCOAddress addressWithDisplayName:@"Glenn Posadas" mailbox:@"admin@glennvon.com"]];
[[builder header] setFrom:address];
[[builder header] setTo:to];
[[builder header] setSubject:@"This is a nice subject"];
[builder setHTMLBody:@"The motherloving body."];
@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
@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
//
// ViewController.swift
// TestNavigation
//
// Created by Glenn Von C. Posadas on 11/11/2018.
// Copyright © 2018 Glenn Von C. Posadas. All rights reserved.
//
import UIKit

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:

@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]

@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 / 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 {