Skip to content

Instantly share code, notes, and snippets.

View ccabanero's full-sized avatar

Clint Cabanero ccabanero

View GitHub Profile
@ccabanero
ccabanero / Fade Out TitleView on Swipe
Last active November 30, 2022 03:33
Fade Out TitleView on Swipe
/**
For configuring the NavigationBar to show/hide when user swipes
- returns: void
*/
func configureNavigationBarAsHideable() {
if let navigationController = self.navigationController {
// respond to swipe and hide/show
navigationController.hidesBarsOnSwipe = true
@ccabanero
ccabanero / Show Navigation Bar if scrolled to top
Last active October 1, 2018 15:57
Show Navigation Bar if scrolled to top
/**
For showing the NavigationBar when scrolled to the top
- returns: void
*/
func showNavigationBarOnScrollToTop(scrollView: UIScrollView) {
if scrollView.contentOffset.y < 0 {
if let navigationController = self.navigationController {
@ccabanero
ccabanero / Add a subView in back of Status Bar
Created March 10, 2016 22:38
Add a subView in back of Status Bar
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// For Setting the background color of the Navigation Bar
let navigationBarAppearace = UINavigationBar.appearance()
let navigationBarColor = UIColor.blackColor()
navigationBarAppearace.barTintColor = navigationBarColor
// Add a view in back of status bar text (needed when UINavigationBar is hidden)
@ccabanero
ccabanero / Hide Navigation Bar on Swipe
Last active March 11, 2016 14:15
Hide Navigation Bar on Swipe
override func viewDidAppear(animated: Bool) {
configureNavigationBarAsHideable()
}
/**
For configuring the NavigationBar to show/hide when user swipes
- returns: void
*/
func configureNavigationBarAsHideable() {
@ccabanero
ccabanero / Adding an image to Center of Navigation Bar
Created March 10, 2016 20:03
Adding an image to Center of Navigation Bar
override func viewDidLoad() {
super.viewDidLoad()
addCenterImageToNavigationBar("starwars")
}
/**
For adding an ImageView to the center of a navigation bar.
- parameter imageName: The name of the image.
- returns: void
*/
@ccabanero
ccabanero / Change Navigation Bar background color via Appearance Proxy
Created March 10, 2016 19:09
Change Navigation Bar background color via Appearance Proxy
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// For Setting the background color of the Navigation Bar
let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.barTintColor = UIColor.blackColor()
return true
}
@ccabanero
ccabanero / Installing Server Side Swift with Perfect on AWS Elastic Compute Cloud
Last active March 7, 2016 16:46
Installing Server Side Swift with Perfect on AWS Elastic Compute Cloud
Title: Installing Server Side Swift with Perfect on AWS Elastic Compute Cloud
Target Server OS: Ubuntu 14.04
Target Cloud Infrastructure: Amazon Web Services - Elastic Compute Cloud
Target Ubuntu:
AWS AMI Name is Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-9abea4fb
// install dependencies
$ sudo apt-get update
$ sudo apt-get --assume-yes install git clang libicu-dev libssl-dev libevent-dev libsqlite3-dev libsqlite3-dev libcurl4-openssl-dev uuid-dev make
@ccabanero
ccabanero / Strings for Fragments
Created March 7, 2016 05:15
Strings for Fragments
<resources>
<string name="hello_import_fragment">I am the IMPORT Fragment Layout</string>
<string name="hello_gallery_fragment">I am the GALLERY Fragment Layout</string>
<string name="hello_slideshow_fragment">I am the SLIDESHOW Fragment Layout</string>
<string name="hello_tools_fragment">I am the TOOLS Fragment Layout</string>
</resources>
@ccabanero
ccabanero / NavigationView Menu Items
Created March 7, 2016 05:09
NavigationView Menu Items
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camera"
android:icon="@drawable/ic_menu_camera"
android:checked = "true"
android:title="Import" />
<item
android:id="@+id/nav_gallery"
@ccabanero
ccabanero / Set Default Fragment in onCreate
Created March 7, 2016 05:06
Set Default Fragment in onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// FAB button