Skip to content

Instantly share code, notes, and snippets.

View Mastersam07's full-sized avatar
๐Ÿš€
building amazing things

Samuel Abada Mastersam07

๐Ÿš€
building amazing things
View GitHub Profile
@Mastersam07
Mastersam07 / export.dart
Created February 18, 2025 04:12
Exports
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:screenshot/screenshot.dart';
import 'dart:io';
import 'dart:async';
import 'package:path_provider/path_provider.dart';
class ImageObject {
final String text;
final String imageUrl;
@Mastersam07
Mastersam07 / fee.ts
Created December 20, 2024 10:30
Paystack fee
class PaystackSetup {
private readonly decimalFee: number = 0.015; // 1.5%
private readonly feeCap: number = 2000; // Maximum fee per transaction
private readonly flatFee: number = 100; // Flat fee applied for transactions >= NGN 2,500
/// Calculates the total price to be charged to the customer, including transaction fees.
calculateTotalPrice(price: number): number {
if (price < 2500) {
return this.calculateBelow2500(price);
}
{
"What's your full name?": "Samuel Abada",
"Select your sub-team?": "Developer",
"YouTube Song": "https://music.youtube.com/watch?v=sjcgg9fSf1o",
"What words do you live by? (Give us a quote)": "Surviving is winning. Everything else is bullshit fairy tale.",
"Fun Fact": "I blow bubbles and fight crime",
"Please share a link to your headshot.": "https://i.ibb.co/C88CpDX/DSC09758.jpg",
"LinkedIn Profile URL": "https://www.linkedin.com/in/abada-samuel/",
"Instagram Profile URL": "https://www.instagram.com/codefarmer_/",
"Twitter Profile URL": "https://x.com/mastersam_",
#!/bin/bash
# Function to find the DSYM file
find_dsym() {
find "$CI_DERIVED_DATA_PATH" -name "*.dSYM" | head -1
}
# Function to determine the current flavor
get_flavor() {
if [[ "$CI_WORKFLOW_NAME" == *"Development"* ]]; then
@Mastersam07
Mastersam07 / widgetbook.dart
Last active September 17, 2024 13:23
Conference App Widgetbook
import 'package:cave/cave.dart';
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
import 'main.directories.g.dart';
void main() {
runApp(const WidgetbookApp());
}
@Mastersam07
Mastersam07 / state_restoration.dart
Last active October 9, 2024 10:59
RestorableTabController
/// A [RestorableProperty] that knows how to store and restore a
/// [TabController].
///
/// The [TabController] is accessible via the [value] getter. During
/// state restoration, the property will restore [TabController.index]
/// to the value it had when the restoration data it is getting restored from
/// was collected.
class RestorableTabController extends RestorableChangeNotifier<TabController> {
/// Creates a [RestorableTabController] to control the tab index of
/// [TabBar].
@Mastersam07
Mastersam07 / clean_project.sh
Last active September 9, 2024 12:33
A script to clean all flutter projects on your machine
#!/bin/bash
# Directories to exclude
EXCLUDE_DIRS=(
"/System"
"/Library"
"/Applications"
"/Volumes"
"/opt/homebrew"
"/opt/homebrew/bin/fvm"
@Mastersam07
Mastersam07 / traversal.dart
Created July 14, 2024 23:02
Find scrollables in viewport
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:flutter/material.dart';
GlobalKey<_CounterWidgetState> counterKey = GlobalKey<_CounterWidgetState>();
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Mastersam07
Mastersam07 / clean_pub_cache.md
Last active May 18, 2024 10:45
Clean pub cache directories
#!/bin/bash

# Paths to the pub cache directories
PUB_CACHE_HOSTED_DIRS=("$HOME/.pub-cache/hosted/pub.dev" "$HOME/.pub-cache/hosted/pub.dartlang.org")
PUB_CACHE_HASHES_DIR="$HOME/.pub-cache/hosted-hashes/pub.dev"
PUB_CACHE_GIT_DIR="$HOME/.pub-cache/git"

# Function to clean old versions from a given directory
clean_old_versions() {