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
/// | |
/// The Result Monad | |
/// | |
abstract class Result<T> { | |
bool isSuccess() { | |
return this is Success; | |
} | |
Success<T> asSuccess() { |
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
# https://www.regextester.com/109925 | |
CONVENTIONS_URL = "your link" | |
def validate_title_format | |
def valid_title_format?(title) | |
conventional_commit_regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?: .*$/ | |
result = title =~ conventional_commit_regex | |
result != nil | |
end |
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
class Person { | |
Person(this.name); | |
final String name; | |
String toString() => name; | |
} | |
void main() { | |
final items = [Person("juan"), Person("pedro"), Person("coso")]; |
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
Stream<String> otherNumbers() { | |
return Stream.fromIterable(["2", "3"]); | |
} | |
Stream<String> allNumbers() async* { | |
yield "1"; | |
yield* otherNumbers(); | |
} |
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
#!/usr/bin/env bash | |
# | |
# Runs dartfmt from dart_style to check if all of the source files are well formatted | |
# Requires you to have dartfmt already in your path with 'pub global activate dart_style' | |
# | |
echo "-> Running 'flutter format' to check project dart style 🤓" | |
RESULT=$(flutter format -n lib/main.dart lib/src/ test/) |
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
/// Function to get the changed value everytime | |
typedef GetChangeFunction<T> = T Function(); | |
extension AsStream<T> on ChangeNotifier { | |
Stream<T> statusAsStream(GetChangeFunction<T> getChange) { | |
final controller = StreamController<T>(); | |
// Redirect status changes into the Stream |
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
// The abstractions | |
abstract class Result<T> { | |
} | |
class Success<T> extends Result<T> { | |
final T body; | |
Success(this.body); | |
} |
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
abstract class Result<T> { } | |
class Success<T> extends Result<T> { | |
final T body; | |
Success(this.body); | |
} | |
class Failure<T> extends Result<T> { |
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
// Merge of | |
// https://github.com/mgouline/android-samples/blob/master/jacoco/app/build.gradle | |
// and https://github.com/pushtorefresh/storio/blob/master/gradle/jacoco-android.gradle | |
// Requires Jacoco plugin in build classpath. | |
apply plugin: 'jacoco' | |
jacoco { | |
toolVersion = "0.8.3" | |
} |