Skip to content

Instantly share code, notes, and snippets.

View themobilecoder's full-sized avatar
👨‍💻

Rafael Delos Santos themobilecoder

👨‍💻
View GitHub Profile
@themobilecoder
themobilecoder / private_fork.md
Created December 26, 2023 01:09 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@themobilecoder
themobilecoder / pubspec.yaml
Created December 19, 2022 10:49
[Flutter] Compatible Version of build_runner and bloc_test
mockito: ^5.3.2
bloc_test: ^9.0.2
build_runner: ^2.1.7
@themobilecoder
themobilecoder / PlacesActivity.kt
Created June 10, 2021 03:59 — forked from murki/PlacesActivity.kt
The poor man's Dagger: Exemplifying how to implement dependency injection on Android by (ab)using ApplicationContext's getSystemService(). Here we attain inversion of control without the need of any external library. We also use Kotlin's extension methods to provide a friendlier, strongly-typed API to locate dependencies.
class PlacesActivity : AppCompatActivity() {
private lateinit var placesPresenter: PlacesPresenter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// This is how you instantiate your Presenter while the service locator resolves all of its dependencies
// Note that the explicit type argument <PlacesPresenter> is not even necessary since Kotlin can infer the type
placesPresenter = application.getSystemService<PlacesPresenter>()
}
}
@themobilecoder
themobilecoder / part_of_main_screen.dart
Last active July 5, 2020 01:46
InkRibbon code snippets
@override
void initState() {
super.initState();
_typewriterKeyboardController = TypewriterKeyboardController();
_typewriterKeyboardController.textStream.listen(_onTextReceived);
}
@override
Widget build(BuildContext context) {
@themobilecoder
themobilecoder / app.dart
Last active May 19, 2020 11:35
Flutter Integration Test code snippets
import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_integration_test/main.dart' as production_app;
void main() {
enableFlutterDriverExtension();
production_app.main();
}
@themobilecoder
themobilecoder / app_config.dart
Last active May 12, 2020 10:14
Flutter Flavors code
import 'package:flutter/material.dart';
import 'package:flutter_flavors/repository/dog_repository.dart';
abstract class AppConfig {
String get appName;
DogRepository get dogRepository;
ColorSwatch get colorSwatch;
}
@themobilecoder
themobilecoder / animated_list_screen.dart
Last active April 23, 2020 00:35
Flutter list animation
class ListScreen extends StatelessWidget {
final DataSource _dataSource = DataSource();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('List Animation', style: TextStyle(fontWeight: FontWeight.bold)),
),
body: FutureBuilder<List<String>>(
@themobilecoder
themobilecoder / home_main_content_pseudocode.dart
Last active August 10, 2020 05:39
How to make an online radio app in Flutter part 2
BlocBuilder<StationsBloc, StationsState>(
condition: (context, state) {
return (state is! FetchingNextStationsState);
},
builder: (context, state) {
if (state is InitialState) {
//Send fetch stations event
} else if (state is LoadingStationsState) {
//Display Loading widget
} else if (state is StationsFetchedState) {
@themobilecoder
themobilecoder / home_screen.dart
Last active March 11, 2020 08:58
How to make an online radio app in Flutter part 1
class HomeScreen extends StatelessWidget {
final _planetRockUrl = 'https://stream-mz.planetradio.co.uk/planetrock.mp3';
final _planetRockImage = 'assets/images/planet_rock.png';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Online Radio'),
),
@themobilecoder
themobilecoder / app.dart
Last active August 29, 2022 07:28
Simple Bloc Pattern examples
class App extends StatelessWidget {
final MusicPlayer musicPlayer = DummyMusicPlayer();
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Music Player',
theme: ThemeData(
primarySwatch: Colors.blue,
),