This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initialize MessageCenter | |
let messageCenter = MessageCenter() | |
//Send Notifications | |
messageCenter.send(name: .userLoggedIn) | |
//Observer Notifications | |
messageCenter.observe(name: .userLoggedIn) { [weak self] _ in | |
// Do something on notification | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input } from '@angular/core'; | |
import { Router } from '@angular/router'; | |
import { AngularFire, FirebaseListObservable } from 'angularfire2'; | |
import { Observable } from 'rxjs'; | |
declare var firebase: any; | |
interface Image { | |
path: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//USAGE | |
class ViewController: UIViewController { | |
@IBOutlet weak var lblTest: UILabel! | |
@IBOutlet weak var tvTeest: UITextView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
var formattedString = NSMutableAttributedString() | |
formattedString = formattedString |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ToolbarFragment extends Fragment { | |
ToolbarListener activityCallback; | |
public interface ToolbarListener { | |
public void onButtonClick(int position, String text); | |
} | |
} | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func solution(_ A : inout [Int]) -> Int { | |
var counter = [Int](repeating: 0, count: A.count + 1) | |
for num in A { | |
if num > counter.count - 1 { | |
return 0 | |
} | |
counter[num] = counter[num] + 1 | |
if counter[num] > 1 { | |
return 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func solution(inout A : [Int]) -> Int { | |
var difference : Int? | |
for index in 1..<A.count { | |
var fsum = 0; | |
var ssum = 0; | |
for i in 0..<index { | |
fsum += A[i] | |
} | |
for i in index..<A.count { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Controller { | |
static let mainboard = UIStoryboard(name: "Main", bundle:nil) | |
static let settingboard = UIStoryboard(name: "Settings", bundle: nil) | |
static var Home:HomeController { | |
return mainboard.instantiateViewControllerWithIdentifier("HomeController") as! HomeController | |
} | |
static var Setting:SettingController { | |
return messageCenterBoard.instantiateViewControllerWithIdentifier("SettingController") as! SettingController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Usage 1 | |
let mainBoard = UIStoryboard(name: "Main", bundle: nil) | |
let homeController = storyboard.instantiateViewControllerWithIdentifier("HomeController") as! HomeController | |
self.navigationController?.showViewController(homeController, sender: nil) | |
//Usage 2 | |
let settingBoard = UIStoryboard(name: "Settings", bundle: nil) | |
let settingController = storyboard.instantiateViewControllerWithIdentifier("SettingsController") as! SettingController | |
self.navigationController?.showViewController(settingController, sender: nil) |