Skip to content

Instantly share code, notes, and snippets.

View rolandkakonyi's full-sized avatar

Roland Kákonyi rolandkakonyi

View GitHub Profile
@pepasflo
pepasflo / .gitignore
Last active October 22, 2023 12:06
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
secrets/
@raxityo
raxityo / MySocketManager.swift
Created July 19, 2018 05:22
SocketIO + RxSwift = Awesomeness 🚀
import RxCocoa
import RxSwift
import SocketIO
final class MySocketManager {
struct Relays {
// Custom events:
/// User properties updated
@ryuta46
ryuta46 / ParameterizedTest.swift
Last active April 7, 2019 22:00
Swift 4 XCTest parameterized test template and sample.
import Foundation
import XCTest
// Parameterized Test Template
class ParameterizedTest : XCTestCase {
class func createTestCases() -> [ParameterizedTest] {
fatalError("""
You must override createTestCases() in following way.
override class func createTestCases() -> [ParameterizedTest] {
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}
/// Every view interacting with a `SayHelloViewModel` instance can conform to this.
protocol SayHelloViewModelBindable {
var disposeBag: DisposeBag? { get }
func bind(to viewModel: SayHelloViewModel)
}
/// TableViewCells
final class TextFieldCell: UITableViewCell, SayHelloViewModelBindable {
@IBOutlet weak var nameTextField: UITextField!
var disposeBag: DisposeBag?
@Herakleis
Herakleis / Singleton+AuthManager.swift
Created August 18, 2017 20:56
Singleton+Template
import RxSwift
import RxSwiftExt
enum AuthenticationStatus {
case none
case error(AuthServiceError)
case user(String)
}
final class AuthManager {
// Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this.
// The goal is basically to try to guarantee that every throwing function in the app throws an
// ApplicationError instead of some unknown error type. We can't actually enforce this statically
// But by following this convention we can simplify error handling
enum ApplicationError: Error, CustomStringConvertible {
// These are application-specific errors that may need special treatment
case specificError1
case specificError2(SomeType)
@aksel
aksel / Kotlin Socket.IO example
Last active February 12, 2021 11:35
Kotlin Socket.IO example connection function.
import io.socket.client.IO
import io.socket.client.Socket
fun connect() {
val socket = IO.socket("http://localhost:4000?user=aksel")
socket.connect()
.on(Socket.EVENT_CONNECT, { println("connected") })
.on(Socket.EVENT_DISCONNECT, { println("disconnected") })
}
@iliakan
iliakan / .gitconfig
Created June 29, 2017 21:19 — forked from rambabusaravanan/.gitconfig
Git Diff and Merge Tool - IntelliJ
# Linux
# add the following to "~/.gitconfig" file
[merge]
tool = intellij
[mergetool "intellij"]
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]
@mminer
mminer / SocketIO+Rx.swift
Created December 2, 2016 20:27
SocketIOClient extension to subscribe to events via RxSwift observable.
import RxSwift
import SocketIO
extension Reactive where Base: SocketIOClient {
public func on(_ event: String) -> Observable<[Any]> {
return Observable.create { observer in
let id = self.base.on(event) { items, _ in
observer.onNext(items)
}