Skip to content

Instantly share code, notes, and snippets.

View herveGuigoz's full-sized avatar

Guigoz Herve herveGuigoz

View GitHub Profile
<?php
namespace App\Command;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
class ApiClient {
ApiClient({
required String baseURL,
required http.Client client,
List<HttpInterceptor>? interceptors,
}) : _client = HttpClient(baseURL: baseURL, interceptors: interceptors, client: client);
/// HTTP client to send requests
final HttpClient _client;
}
@herveGuigoz
herveGuigoz / bar-chart.dart
Created December 31, 2024 14:06
Bar Chart
// ignore_for_file: cascade_invocations
import 'dart:math' as math;
import 'package:flutter/widgets.dart';
enum BarChartAlignment { start, center }
/// Constructs a bar chart widget.
class BarChartWidget extends LeafRenderObjectWidget {
@herveGuigoz
herveGuigoz / Caddyfile
Last active April 21, 2025 08:51
Flutter Caddy
{$SERVER_NAME} {
root * /srv/app/public
file_server
try_files {path} /index.html
}
@herveGuigoz
herveGuigoz / Dockerfile
Last active April 21, 2025 08:54
Pocketbase Docker
FROM alpine:latest
ARG PB_VERSION=0.22.21
RUN apk add --no-cache \
unzip \
ca-certificates
# download and unzip PocketBase
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
@herveGuigoz
herveGuigoz / firebase_image.dart
Last active April 21, 2025 08:56
Firebase image Provider
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'dart:async';
import 'dart:ui' as ui;
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
/// An [ImageProvider] that retrieves an image from Firebase Storage.
@immutable
import 'dart:math';
typedef Stringify<T> = String Function(T item);
/// Utility class to apply Levenshtein score on each items
class SearchResult<T> implements Comparable<SearchResult<T>> {
SearchResult(this.value, {required this.score});
final double score;
import 'package:freezed_annotation/freezed_annotation.dart';
part 'form.freezed.dart';
@freezed
class FormStatus with _$FormStatus {
// Class representing the status of a form at any given point in time.
const FormStatus._();
/// The form has not yet been submitted.
@herveGuigoz
herveGuigoz / DockerHubPolicy.json
Created January 23, 2024 09:19
Docker Registry avec Minio et Traefik
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:ListBucketMultipartUploads"
],
@herveGuigoz
herveGuigoz / languageFlagMap.dart
Last active April 21, 2025 09:12
ISO 639-1 language codes and flag emojis based on the country with the largest population
final Map<String, String> languageFlagMap = {
'aa': '🇪🇹', // Afar - Ethiopia
'ab': '🇬🇪', // Abkhaz - Georgia
'af': '🇿🇦', // Afrikaans - South Africa
'am': '🇪🇹', // Amharic - Ethiopia
'ar': '🇪🇬', // Arabic - Egypt
'as': '🇮🇳', // Assamese - India
'ay': '🇧🇴', // Aymara - Bolivia
'az': '🇦🇿', // Azerbaijani - Azerbaijan
'be': '🇧🇾', // Belarusian - Belarus