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 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
abstract class BaseService { | |
static const String baseUrl = 'http://some-supercool-api-address:s0m3-p0rt'; | |
final String endpoint; | |
late final Map<String, dynamic> response; | |
BaseService({required this.endpoint}); |
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
SizedBox( | |
height: MediaQuery.of(context).size.height - | |
kToolbarHeight - // Default AppBar size | |
MediaQuery.of(context).padding.top, // Default status bar size | |
child: Text(''), | |
); |
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
name: "Ruby on Rails trigger Github Actions" | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest |
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
bool getRandomElement(List<bool> list) => list[Random().nextInt(list.length)]; |
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 'package:flutter_week_view/flutter_week_view.dart'; | |
DateTime now = DateTime.now(); | |
DateTime date = DateTime(now.year, now.month, now.day); | |
DayView dayView() { | |
return DayView( | |
date: now, | |
events: [ | |
FlutterWeekViewEvent( |
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
void main() { | |
// Find first date and last date of CURRENT WEEK | |
DateTime today = DateTime.now(); | |
print(findFirstDateOfTheWeek(today)); | |
print(findLastDateOfTheWeek(today)); | |
// Find first date and last date of any provided date | |
DateTime date = DateTime.parse('2023-09-01'); | |
print(findFirstDateOfTheWeek(date)); | |
print(findLastDateOfTheWeek(date)); |
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 'dart:convert'; | |
// package needed: https://pub.dev/packages/crypto | |
import 'package:crypto/crypto.dart'; | |
void main() { | |
var passwordBytes = utf8.encode("s0me-super-cool-p@$$WorD-here"); | |
var passwordEncrypt = sha256.convert(passwordBytes); |
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
/** | |
* It forces strong passwords | |
* @require String password | |
* @return bool | |
* | |
* return true if password has: | |
* 1 capitalized character | |
* 1 special character | |
* 1 number | |
*/ |
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
void testConnection() async { | |
try { | |
final connection = await InternetAddress.lookup('www.google.com'); | |
if (connection.isNotEmpty && connection.first.rawAddress.isNotEmpty) { | |
hasConnection = true; | |
} | |
} on SocketException catch (_) { | |
hasConnection = false; | |
} | |
} |
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 'package:flutter/material.dart'; | |
class AppDrawer extends StatelessWidget { | |
const AppDrawer({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Drawer( | |
backgroundColor: Colors.white, | |
child: Column( |
NewerOlder