View RepoResult.kt
This file contains 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
/* Different solutions for future RepoResult (?) object! */ | |
/* | |
* James! | |
*/ | |
sealed interface ResultReason |
View result_deserialization.kt
This file contains 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
override fun deserialize(json: JsonElement?, typeOfT: Type?, context: JsonDeserializationContext?): Result<*, *>? { | |
return when { | |
// Is it a JsonObject? Bingo! | |
json?.isJsonObject == true -> { | |
// Let's try to extract the type in order | |
// to deserialize this object | |
val parameterizedType = typeOfT as ParameterizedType | |
// Returns an Ok with the value deserialized |
View fastlane_beta.ruby
This file contains 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
desc "" | |
lane :beta do |lane| | |
# ensure you are in master branch | |
ensure_git_branch | |
# ensure that master branch is clean | |
ensure_git_status_clean | |
# check the semantic parameter entered |
View combineReducers.kt
This file contains 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
// | |
// Reducer interface definition | |
// | |
typealias Reducer<ReducerStateType> = (action: Action, state: ReducerStateType?) -> ReducerStateType | |
// | |
// Combine reducers method | |
// | |
fun<T: StateType> combineReducers(vararg reducers: Reducer<T>): Reducer<T> { | |
return { action, state -> |
View create_signed_app.ruby
This file contains 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
desc "Create a signed version of the app" | |
lane :signed_apk do | |
# get version and build number from git | |
# https://blog.uncommon.is/using-git-to-generate-versionname-and-versioncode-for-android-apps-aaa9fc2c96af | |
versionName = sh("git describe --dirty").gsub(/\s+/, "") | |
# +520 to sync version codes with the previous app. | |
versionCode = sh("git rev-list --first-parent --count origin/master").gsub(/\s+/, "").to_i + 520 | |
keyPath ="#{sh("pwd").chomp}/keystore.jks" |
View RxCBCentralManagerExample.swift
This file contains 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
// Creates the Rx version of the API passing the same parameters as the system version | |
let centralManager: RxCBCentralManager = RxCBCentralManager(queue: DispatchQueue.main, options: nil) | |
// Creates a Rx pipe using the published methods | |
centralManager.scanForPeripherals(withServices: [requiredServiceUIDD], options: nil) | |
.filter { (peripheral: CBPeripheral) -> Bool in | |
if let name = peripheral.name { | |
return name.contains("peripheralName") | |
} | |
return false |
View RxCBCentralManager.swift
This file contains 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
/** | |
Lightweight Rx wrapper to CBCentralManager | |
to hide all implementation details. | |
*/ | |
public class RxCBCentralManager { | |
// system API manager | |
private let centralManager: CBCentralManager | |
// internal delegate | |
private let internalDelegate = InternalDelegate() | |
private var lastConnectedDevice: CBPeripheral? |
View action_creator.swift
This file contains 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
// Action creator definition | |
func fetchAppsFromStore(state: State, store: Store<State>) -> Action? { | |
let request = AppStoreRequests.apps(showDevelopment: state.settingsState.isDevelopmentMode) | |
let task = JsonRequestTask<[AppId]>(dispatcher: dispatcher) | |
// Async task call | |
task.perform(request) | |
.subscribe(onNext: { result in |
View middleware_kotlin.kt
This file contains 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
internal val deviceMiddleware: Middleware<AppState> = { dispatch, state -> | |
// dispatch: Function that send actions to the begining of the middleware list | |
// state: Function that returns an atomic copy of the state | |
// next: Function to send the action to the next middleware | |
// action: New incoming action | |
{ next -> | |
{ action -> | |
when (action) { | |
is DeviceConnected -> { | |
val currentState = state()?.appStoreState |
View async_seudo_code.swift
This file contains 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
if state.needsAsyncData { | |
dispatch(LoadingAction) | |
asyncCall() | |
.whenOk { dispatch(OkAction(result) } | |
.whenError { dispatch(ErrorAction(error)) } | |
} |
NewerOlder