Skip to content

Instantly share code, notes, and snippets.

View sixtusagbo's full-sized avatar
🏡
Working from home

Sixtus Miracle Agbo sixtusagbo

🏡
Working from home
View GitHub Profile
# SETUP #
DOMAIN=example.com
PROJECT_REPO="git@github.com:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
@sixtusagbo
sixtusagbo / four_point_design_system.dart
Created August 3, 2024 07:09
Using extension types to implement 4-point grid system in flutter
// This code was borrowed from here: https://x.com/mkobuolys/status/1819377685639950585
const _multiplier = 4.0;
extension type DesignSystemSpace._(double spacing) implements double {
DesignSystemSpace(double token) : spacing = token * _multiplier;
}
final space = DesignSystemSpace(4); // 16
final padding = EdgeInsets.all(DesignSystemSpace(4)); // EdgeInsets.all(16.0)
@sixtusagbo
sixtusagbo / helpers.dart
Created July 26, 2024 15:06
Add a widget between each pair of widgets in a list of widgets.
/// Extension on Iterable<Widget> to add a specified widget between each pair of widgets.
extension WidgetIterableExtension on Iterable<Widget> {
List<Widget> addBetween(Widget child) {
final iterator = this.iterator;
final result = <Widget>[];
if (iterator.moveNext()) result.add(iterator.current);
while (iterator.moveNext()) {
result
@sixtusagbo
sixtusagbo / main.dart
Last active July 16, 2024 15:29
Text slide animation in Flutter (No external package)
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Text Slide Animation')),
@sixtusagbo
sixtusagbo / main.dart
Last active March 20, 2024 03:19
Rajvis Infinite size issue
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@sixtusagbo
sixtusagbo / git_commited_but_unpushed.md
Last active March 19, 2024 06:51
How to get a list of all the files that have been commited but not yet pushed
You can use the following Git command in your terminal to see a list of all files that have been committed but not yet pushed:
git diff --name-only origin/main

This command compares your local repository (including committed changes) with the main branch on the origin remote repository.

To view more statistics on it:
git diff --stat origin/main
@sixtusagbo
sixtusagbo / translators.html
Created March 18, 2024 01:22
i18n for web w/ translators
<!-- Google Translate -->
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script>
@sixtusagbo
sixtusagbo / release.sh
Created February 26, 2024 10:16 — forked from rodydavis/release.sh
Flutter Release Script with Fastlane
#!/bin/bash
echo "App Release Automator by @rodydavis"
action="$1"
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
if [ ${action} = "build" ]; then
@sixtusagbo
sixtusagbo / example.dart
Created December 7, 2023 14:07 — forked from lukepighetti/example.dart
Another logger
class MyService {
final _log = Logger('MyService');
void init() {
try {
// operation
_log("initialized");
} catch(e, stackTrace){
_log.e("init() error", e, stackTrace);
}
@sixtusagbo
sixtusagbo / main.dart
Created November 14, 2023 01:41
Weird and Not Weird numbers...
import 'dart:math';
void main() {
Random random = Random();
/// Generate random number between 1 to 10
int n = random.nextInt(10)+1;
bool _even = n % 2 == 0;
/// Inclusive range from 2 to 5
List<int> rangeOne = [for(var i=2; i<=5; i++) i];