Skip to content

Instantly share code, notes, and snippets.

View longvudai's full-sized avatar

Long Vu longvudai

View GitHub Profile
@longvudai
longvudai / dedict.c
Created March 27, 2018 10:38 — forked from josephg/0dedict.py
Apple dictionaries
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "zlib.h"
#define CHUNK 16384
/*
40 Length of the zlib stream
//
// ViewController.swift
// EventKit
//
// Created by Dai Long on 7/21/18.
// Copyright © 2018 Dai Long. All rights reserved.
//
import UIKit
import EventKit
@longvudai
longvudai / UITabBarController+UINavigationController.swift
Last active December 4, 2018 19:43
preferredStatusBarStyle() to work within UINavigationController and UITabBarController
extension UITabBarController {
open override var childForStatusBarStyle: UIViewController? {
return selectedViewController
}
}
extension UINavigationController {
open override var childForStatusBarStyle: UIViewController? {
return visibleViewController
}
@longvudai
longvudai / MyController.swift
Created December 4, 2018 19:42
set preferredStatusBarStyle when view controller is presented
// in myViewController
class MyViewController: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func awakeFromNib() {
super.awakeFromNib()
modalPresentationCapturesStatusBarAppearance = true //allow this VC to control the status bar appearance
@longvudai
longvudai / Person.swift
Last active March 18, 2020 18:10
ARC-medium
class Person {
let name: String
init(name: String) {
self.name = name
print("\(name) is being initialized")
}
deinit {
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@longvudai
longvudai / UIFont+Helpers.swift
Created June 30, 2021 03:53 — forked from shaps80/Font.swift
A set of UIFont helpers that matches the equivalent SwiftUI Font API.
import UIKit
public extension UIFont {
enum Leading {
case loose
case tight
}
private func addingAttributes(_ attributes: [UIFontDescriptor.AttributeName: Any]) -> UIFont {
@longvudai
longvudai / SplitViewController.swift
Created February 3, 2022 08:01 — forked from max-potapov/SplitViewController.swift
UITabBarController inside Master View of UISplitViewController
//
// SplitViewController.swift
// Gist
//
// Created by Maxim Potapov on 17/12/2017.
// Copyright © 2017 Maxim Potapov. All rights reserved.
//
import UIKit
import UIKit
/*:
DateComponentsFormatter: A formatter that creates string representations of quantities of time.
*/
let dateComponentsFormatter = DateComponentsFormatter()
/*:
A DateComponentsFormatter can be configured with an array of NSCalendarUnits. These components are then used in the output.
import Firebase
import FirebaseAuth
extension FirebaseApp {
private static var didConfigForAppExtension = false
static func configureFirebaseForAppExtension(
extensionPlistName: String,
accessGroup: String,
force: Bool = false