Skip to content

Instantly share code, notes, and snippets.

View alfian0's full-sized avatar
🎯
Focusing

Muhammad Alfiansyah alfian0

🎯
Focusing
View GitHub Profile
public class Stack {
private Object[] elements;
private int size = 0;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public Stack() {
elements = new Object[DEFAULT_INITIAL_CAPACITY];
}
public void push(Object e) {
function() {
HRESULT error = S_OK;
if (SUCCEEDED(Operation1()) && SUCCEEDED(Operation2()) && SUCCEEDED(Operation3()) && SUCCEEDED(Operation4())) {
return S_OK;
} else {
return OPERATIONFAILED;
}
}
@alfian0
alfian0 / gist:3fdacf7bbeada43c66c5beba14e84151
Created August 23, 2018 08:44 — forked from kublaios/gist:f01cdf4369c86ddd6d71
Making a PEM File for iOS Push Notifications (From Ray Wenderlich's tutorial)
#Β Convert the .cer file into a .pem file:
$ openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem
# Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -in PushChatKey.p12 -out PushChatKey.pem
# Finally, combine the certificate and key into a single .pem file
$ cat PushChatCert.pem PushChatKey.pem > ck.pem
# At this point it’s a good idea to test whether the certificate works.
import UIKit
import Common
import RxSwift
typealias AboutCellConfigured = CellConfigurator<AboutCell, AboutCell.Input>
class AboutCell: UITableViewCell {
@IBOutlet weak var textView: UITextView!
@alfian0
alfian0 / CleanArchitecture.swift
Last active July 29, 2018 03:39
Simple Clean Arcitecture
struct CreateOrderRequest {
// MARK:
// Interactor
// Get or fetch Model Response From API
struct CreateOrderResponse {
// MARK:
// ViewModel ~> Responsibility to parse Interactor response to Model View
struct CreateOrderViewModel {
let orderNumber: Int
let orderName: String
extension Reactive where Base: UserDefaults {
public func `default`<E: Equatable>(_ type: E.Type, _ keyPath: String) -> Observable<E?> {
let center = NotificationCenter.default
let initial = base.object(forKey: keyPath) as? E
let changes = center.rx.notification(UserDefaults.didChangeNotification)
.map { _ in
self.base.object(forKey: keyPath) as? E
}
extension UIApplication {
var statusBarView: UIView? {
return value(forKey: "statusBar") as? UIView
}
}
final class ViewController: UITableViewController {
var viewModel: ViewModel!
let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
let input = viewModel.Input()
@alfian0
alfian0 / ViewModel+Contract.swift
Last active July 4, 2018 04:01
Contract with singleton
final class ViewModel: ViewModelType {
var input: Input
var output: Output!
struct Input {}
struct Output {}
static var shared: ViewModel {
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)