Skip to content

Instantly share code, notes, and snippets.

View emiliodallatorre's full-sized avatar

Emilio Dalla Torre emiliodallatorre

View GitHub Profile
@emiliodallatorre
emiliodallatorre / upload_helper.dart
Created August 17, 2019 09:59
A simple Flutter class to upload files with Flutter for Web.
import 'dart:async';
import 'dart:html';
import 'package:firebase/firebase.dart' as firebase;
import 'package:flutter_web/foundation.dart';
/// Questa classe permette di eseguire l'upload di un'immagine nel database di Firestore.
/// Il meccanismo è abbastanza semplice, ma data l'ingestibilità di riprodurlo ogni volta, è stata astratta dal resto.
/// Verrà inserita in un apposito gist.
@emiliodallatorre
emiliodallatorre / gist:6ce9cbc25b3b00bc114668fc4aee0f82
Created March 18, 2020 12:39
L'errore che trovo nel buildare un progetto
Building com.nextocompany.thingstore for device (ios-release)...
Automatically signing iOS for device deployment using specified development team
in Xcode project: P8WULW25UZ
Running pod install... 13,1s
Running Xcode build...
└─Compiling, linking and signing... 6,2s
Xcode build done. 373,6s
Failed to build iOS app
Error output from Xcode build:
@emiliodallatorre
emiliodallatorre / woocommerce-pdf-italian-add-on.php
Created April 26, 2020 19:05
Implementazione di Fluxstore per WooCommerce PDF Invoices Italian Add-on
<?php
/**
Plugin Name: WooCommerce PDF Invoices Italian Add-on
Plugin URI: https://ldav.it/plugin/woocommerce-pdf-invoices-italian-add-on/
Description: Aggiunge a WooCommerce tutto il necessario per un e-commerce italiano e la fatturazione elettronica
Version: 0.7.0.13
Author: laboratorio d'Avanguardia
Author URI: https://ldav.it/
License: GPLv2 or later
License URI: http://www.opensource.org/licenses/gpl-license.php
@emiliodallatorre
emiliodallatorre / post_header.dart
Created June 17, 2020 13:00
Widget per la riga del titolo superiore ai post
return Row(
children: <Widget>[
CircleAvatar(
backgroundImage: CachedNetworkImageProvider(
post.author.photoUrl,
),
),
Expanded(
child: Text(post.author.displayName),
),
@emiliodallatorre
emiliodallatorre / flutter_clean_all.sh
Created June 20, 2020 09:10
Uno script per pulire recursivamente i progetti in Flutter nella cartella GitHub.
for f in $(ls -d */);
do
echo "Entro in $f."
cd "$f"
flutter clean
cd ..
done
@emiliodallatorre
emiliodallatorre / http_uploader.dart
Created October 4, 2020 15:43
Funzione per caricare un file via http con Flutter.
import 'package:http/http.dart' as http;
class HttpUploader {
Future<void> uploadFile (File file, String nameOnPrinter) async {
String url = "http://192.168.1.125/upload?X-Filename=$nameOnPrinter.gcode";
Map<String, String> headers = {
"Content-Type": "application/octet-stream"
};
@emiliodallatorre
emiliodallatorre / sign_in_apple.dart
Created January 21, 2021 15:08
Funzione per il login con Apple
static Future<UserModel> signInWithApple() async {
final OAuthProvider appleOAuth = OAuthProvider("apple.com");
final AuthorizationCredentialAppleID appleCredential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
);
@emiliodallatorre
emiliodallatorre / cleanser.py
Created May 27, 2021 10:57
Simple utility to put all <wp:author> tag child on the same line of a WordPress WXR/XML export
import os
def main():
export_file_names: list = [
f for f in os.listdir(".") if f.endswith(".xml") and not f.endswith(".correct.xml")]
for export_file_name in export_file_names:
print(f"Going with: {export_file_name}")
@emiliodallatorre
emiliodallatorre / optimized_network_image.dart
Last active August 10, 2021 16:00
A simple wrapper for CachedNetworkImage that lets you specify caching parameters globally.
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:resmedia_manita_flutter/references.dart';
class OptimizedNetworkImage extends StatelessWidget {
final String imageUrl;
final Widget Function(BuildContext, String) placeholder;
final BoxFit fit;
@emiliodallatorre
emiliodallatorre / default.conf
Created August 13, 2021 17:15
La mia configurazione di default per Nginx, che uso nei server con funzionalità PHP.
# server {
# listen 80;
# server_name 127.0.0.1;
# return 301 https://127.0.0.1$request_uri;
# }
server {
listen 80;
# listen 443;
# ssl on;