Skip to content

Instantly share code, notes, and snippets.

View Quaggie's full-sized avatar

Jonathan Bijos Quaggie

  • Rio de Janeiro
View GitHub Profile
import UIKit
// MAKING CHANGE ---------------------------------------------
func makingChange (amount: Int, denominations: [Int]) -> Int {
var waysOfDoingNCents: [Int] = []
for _ in 0...amount {
waysOfDoingNCents.append(0)
}
waysOfDoingNCents[0] = 1
extension Optional {
func then (_ handler: (Wrapped) -> Void) {
switch self {
case .some(let wrapped): return handler(wrapped)
case .none: break
}
}
}
// Analytics helper created by @Quaggie - Jonathan Bijos
import UIKit
struct Analytics {
fileprivate let viewController: UIViewController
fileprivate let tracker = GAI.sharedInstance().defaultTracker
init (forScreen viewController: UIViewController) {
self.viewController = viewController
class TrackOptionsViewController: UIViewController {
var isDismissing = false
override func viewDidLoad() {
super.viewDidLoad()
}
}
extension TrackOptionsViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if isDismissing {
// Created by Diogo Tridapalli on 9/13/16.
// Copyright © 2016 Diogo Tridapalli. All rights reserved.
import Foundation
public struct Log {
public static func info(
_ items: Any...,
functionName: String = #function,
const Discord = require('discord.js')
const client = new Discord.Client()
const fetch = require('node-fetch')
const ytdl = require('ytdl-core')
const streamOptions = { seek: 0, volume: 1 }
let dispatcher = null;
const YOUTUBE_API_URL = 'https://www.googleapis.com/youtube/v3/search'
import Foundation
import UIKit
protocol Storyboardable: class {
static var storyboardName: String { get }
}
extension Storyboardable where Self: UIViewController {
static var storyboardName: String {
return String(describing: self)
//
// Analytics.swift
//
// Created by Jonathan Bijos
// Copyright © 2017 @Quaggie. All rights reserved.
import UIKit
struct Analytics {
typealias Dimensions = [UInt: String]
class DataSource: NSObject {
typealias Callback = ((IndexPath) -> Void)?
var names = [String]()
fileprivate var callback: Callback
init(names: [String]) {
super.init()
self.names = names
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Monta a window de acordo com o tamanho da tela
window = UIWindow(frame: UIScreen.main.bounds)
// Instancia o ViewController
let vc = ViewController()
// Bota como tela principal dentro de uma navigationController
window?.rootViewController = UINavigationController(rootViewController: vc)
// Faz a window ser exibida
window?.makeKeyAndVisible()
return true