Skip to content

Instantly share code, notes, and snippets.

View gausoft's full-sized avatar
🏠
Working from home

Gauthier Eholoum gausoft

🏠
Working from home
View GitHub Profile
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:vinland/src/models/image.dart';
part 'article.freezed.dart';
part 'article.g.dart';
@freezed
class ArticleAttributes with _$ArticleAttributes {
factory ArticleAttributes({
required String title,
@cdsaenz
cdsaenz / index.html
Created August 19, 2022 14:11
Demo Alpine JS and Fetch from Remote API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpine Ajax test</title>
</head>
<body>
<h1>Users API Retrieval Test</h1>
@Roaa94
Roaa94 / infinite_scrolling.dart
Last active September 25, 2023 15:47
Infinite Scrolling with Riverpod
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:dio/dio.dart';
// Disclaimer: This uses the "The Movie Database API (TMDB)"
// https://developers.themoviedb.org/3/getting-started
// With this endpoint:
// https://developers.themoviedb.org/3/people/get-popular-people
/// The FutureProvider that does the fetching of the paginated list of people
@gabrc52
gabrc52 / ideviceforward
Created June 7, 2022 03:39
Forward iOS device from host to guest (OSX-KVM)
#!/bin/bash
# Debug
set -o xtrace
GUEST_IP=192.168.122.221
HOST_IP=192.168.122.1
# Wipe the current usbfluxd, usbmuxd, and socat:
sudo killall usbfluxd
@lukepighetti
lukepighetti / unused_dependencies.js
Created September 4, 2020 14:26
Search a Flutter project for unused dependencies
/// Finds unused dependencies from pubspec.yaml
///
/// Achieves this by parsing pubspec.yaml and recursively
/// searching the lib folder for an import statement that
/// contains the name of each package. Prints out the results.
const fs = require("fs");
const YAML = require("yaml");
const { execSync } = require("child_process");
/// Read pubspec.yaml
@zhabinskiy
zhabinskiy / laravel-livewire-test.php
Last active July 14, 2021 21:41
Laravel Livewire test example
<?php
namespace Tests\Feature;
use App\User;
use Tests\TestCase;
use Livewire\Livewire;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Testing\RefreshDatabase;
@akifarhan
akifarhan / localAuthSettingsForAndroid_kotlin.md
Last active May 8, 2024 01:03
Flutter Local_Auth Setting for Android in Kotlin

Note that local_auth plugin requires the use of a FragmentActivity as opposed to Activity. This can be easily done by switching to use FlutterFragmentActivity as opposed to FlutterActivity in your manifest (or your own Activity class if you are extending the base class).

1. Add USE_FINGERPRINT permission

  • Open android>app>src>main>AndroidManifest.xml
  • Add the permission
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.[your.package]">
  <uses-permission android:name="android.permission.USE_FINGERPRINT"/>
@tanthammar
tanthammar / session-timeout-alert-after-livewire-scripts.blade.php
Last active November 23, 2023 11:50
Laravel Livewire Turbolinks Blade component to keep session alive
{{-- You do not need to add this component if you are using the permanent option in the head component --}}
<script>
if (!window.sessionTimerPermanent && window.Livewire) {
window.livewire.hook('afterDomUpdate', startSessionTimer)
}
// if you are on livewire > 1.3.1 and want to avoid the default error alert
// https://github.com/livewire/livewire/pull/1146
window.livewire.onError(statusCode => {
if (statusCode === 419) {
@barseghyanartur
barseghyanartur / convert_mysql_dump_to_postgresql_dump.md
Created June 11, 2020 14:21
Convert MySQL dump to PostgreSQL dump

Prepare database dump using mysqldump:

mysqldump -u [username] -p [databaseName] --compatible=postgresql --default-character-set=utf8 > database.sql

Clone mysql-postgresql-converter project:

git clone git@github.com:lanyrd/mysql-postgresql-converter.git
@FilledStacks
FilledStacks / stacked_snippets.json
Last active January 2, 2024 04:09
Flutter / Stacked snippets for productivity
{
"Freezed model": {
"prefix": "frz",
"body": [
"@freezed",
"class ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}} with _$${1} {",
" factory ${1}({",
" required ${2:String id},",
" }) = _${1};",
"}"