Skip to content

Instantly share code, notes, and snippets.

View samuelematias's full-sized avatar

samuca samuelematias

View GitHub Profile
@Demwunz
Demwunz / git commands.sh
Created July 3, 2020 16:47
A collection of some useful git commands
# delete all local branches that have been merged into master
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -
# amend a commit to the current time
git commit --amend --date="now"
# add empty git commit without adding files
git commit --allow-empty -m "This will trigger a build"
@rodydavis
rodydavis / flutter_all_fastlane.sh
Last active September 19, 2023 06:20
Using Fastlane for Flutter to deploy iOS, Mac, Android and Web
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
@apgapg
apgapg / deploy.yml
Last active October 7, 2023 16:23
Github Workflow for Building, Releasing Flutter web app to Github Pages and Firebase Hosting
# This is a basic workflow to help you get started with Actions
name: Build, Release app to Github Pages and Firebase Hosting
# name: Test, Build and Release apk
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
@rodydavis
rodydavis / flutter_device_utils.dart
Created June 7, 2020 21:20
Flutter Device Utils
import 'package:flutter/foundation.dart';
import 'dart:io';
bool get isWeb => kIsWeb;
bool get isMobile => !isWeb && (Platform.isIOS || Platform.isAndroid);
bool get isDesktop =>
!isWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux);
bool get isApple => !isWeb && (Platform.isIOS || Platform.isMacOS);
bool get isGoogle => !isWeb && (Platform.isAndroid || Platform.isFuchsia);
@steinbrueckri
steinbrueckri / create-file-in-repo.sh
Last active April 25, 2022 21:30
Create file in GitHub Repo via API - Example
#!/bin/bash
MESSAGE="test"
TOKEN=$(cat ~/.github-token)
FILENAME="$RANDOM-date.txt"
CONTENT=$(date | base64)
USER="steinbrueckri"
REPO="api-test"
MESSAGE="hello world"
@rodydavis
rodydavis / flutter_web_firebase_messaging.dart
Created May 1, 2020 08:02
Firebase Messaging on Flutter Web
import 'dart:async';
import 'package:firebase/firebase.dart' as firebase;
class FBMessaging {
FBMessaging._();
static FBMessaging _instance = FBMessaging._();
static FBMessaging get instance => _instance;
firebase.Messaging _mc;
String _token;
import 'package:flutter/material.dart';
class NameInitialsWidget extends StatelessWidget {
final double width;
final double height;
final String text;
final double fontSize;
final double margin;
const NameInitialsWidget(
extension TextExtension on Text {
Text h1({TextStyle style}) {
TextStyle defaultStyle = TextStyle(
fontFamily: 'Nunito_Sans',
fontSize: 36,
fontWeight: FontWeight.w900,
fontStyle: FontStyle.normal,
letterSpacing: -0.02,
color: SoulphiaTheme.defaultGraySwatch[50],
);
extension PhoneNumberExtension on String {
String get toGHPhoneNumber {
if (this.length != 10) return this;
return '${this.substring(0, 3)} ${this.substring(3, 6)} ${this.substring(6, 10)}';
}
}
@rogood
rogood / pre-push
Last active July 7, 2020 01:15
Flutter Pre Push Hook with Console Messages
#!/usr/bin/env bash
if [[ `git status --porcelain` ]]; then
printf "\e[31;1m%s\e[0m\n" 'This script needs to run against committed code only. Please commit or stash you changes.'
exit 1
fi
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer'
flutter analyze
if [ $? -ne 0 ]; then
printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error'
exit 1