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
fun <T> Flow<T>.stateMachine(configuration: StateChanges<T>.() -> Unit): Flow<StateChanges<T>> = flow { | |
var oldState: T? = null | |
distinctUntilChanged().collect { value -> | |
emit(StateChanges(oldState, value)) | |
oldState = value | |
} | |
}.onEach { | |
configuration(it) | |
} |
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
/** | |
* Starts subscribing / collecting the given Flow and records it's emission to verify them later | |
*/ | |
suspend fun <T> Flow<T>.recordEmissions( | |
recordingScope: CoroutineScope = GlobalScope, | |
verify: suspend SharedFlow<T>.() -> Unit | |
) { | |
val recording = shareIn(recordingScope, SharingStarted.Eagerly, Int.MAX_VALUE) | |
verify(recording) | |
} |
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
package com.klefmusic.eightbars.utils | |
import android.content.Context | |
import android.media.AudioDeviceCallback | |
import android.media.AudioDeviceInfo | |
import android.media.AudioManager | |
import kotlinx.coroutines.ExperimentalCoroutinesApi | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.channels.sendBlocking |
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
/** | |
* Current state of an object. for example the state of a view or the state of a hardware device. | |
*/ | |
interface State | |
/** | |
* A result modifies state. | |
*/ | |
interface Result |
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 {FieldsByTypeName, parseResolveInfo, ResolveTree} from 'graphql-parse-resolve-info'; | |
const parsedResolveInfoFragment = parseResolveInfo(info) as ResolveTree; | |
const curation = await ctx.prismaBinding.query.curation( | |
{ | |
where: { |
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
install new version as seperate cluster | |
https://www.postgresql.org/download/windows/ | |
stop both servers | |
- find the data dir | |
postgres=# show data_directory; data_directory | |
- use pg_ctrl to stop both clusters |
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 {ApolloLink} from 'apollo-link'; | |
import {makeRemoteExecutableSchema} from 'graphql-tools'; | |
import { HTTPLinkDataloader } from "http-link-dataloader"; | |
import * as b from '../generated/Binding' | |
import loadSchema from "../tools/LoadSchema"; | |
import { BatchHttpLink } from "apollo-link-batch-http"; | |
import fetch from 'node-fetch'; | |
import {Pool} from 'pg'; | |
import {GraphQLSchema} from 'graphql'; | |
import {GraphileApolloLink} from './GraphileApolloLink'; |
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 android.arch.lifecycle.ViewModel | |
import android.arch.lifecycle.ViewModelProviders | |
import android.support.v4.app.FragmentActivity | |
import kotlin.reflect.KClass | |
class MainActivity : AppCompatActivity() { | |
val viewModel by bindViewModel(this, MainViewModel::class) | |
override fun onCreate(savedInstanceState: Bundle?) { |
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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* @flow | |
*/ | |
import React from 'react'; | |
import {combineReducers, createStore} from 'redux' | |
import {Button, Text, View} from "react-native"; | |
import {addNavigationHelpers, NavigationActions, StackNavigator} from "react-navigation"; |
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
class StartRecordingActivity : ToolbarActivity() { | |
private val startRecordingViewModel: StartRecordingViewModel by bindViewModel(this, StartRecordingViewModel::class) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
/* your ui code */ | |
} | |
} | |
NewerOlder