Skip to content

Instantly share code, notes, and snippets.

View funder7's full-sized avatar
🎲
Let's go!

Federico Ricchiuto funder7

🎲
Let's go!
View GitHub Profile
@funder7
funder7 / isAssociativeArrayTest.php
Last active January 15, 2022 02:21
Unit testing a function that (tries to) determine if an array is associative (php >= 7.3)
View isAssociativeArrayTest.php
<?php
namespace Tests\Unit;
// based on original work from the PHP Laravel framework
if (!function_exists('str_contains'))
{
function str_contains($haystack, $needle) {
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
}
@funder7
funder7 / vuetify_treeview_select-child-buttons.vue
Last active March 3, 2021 17:58
Adding +/- buttons to vuetify treeview component, allowing to select/deselect all childrens of a group with a single click
View vuetify_treeview_select-child-buttons.vue
<template>
<v-treeview
v-model="selection"
:items="items"
:loading="loading"
:return-object="showSelected"
open-all
selectable
selection-type="independent"
transition
@funder7
funder7 / README.md
Last active January 8, 2021 00:09
Dart: Map all values of an Enum to another List of objects (uses "logger: ^0.9.4")
View README.md

Dart - Enum to Object mapper - helper class

With practical example

Introduction

Enums are a good way to represent a determined set of values, which I use often. They're good when used in code, or when matching some values returned from your backend APIs with the client code for example.

But moving on the UI, you cannot present them as-is to the end user, they must be converted into something more readable.

How it works

@funder7
funder7 / start_proxy.sh
Last active December 15, 2020 12:38
Starts ngrok, and copies the tunnel hostname into an external file (in this case a spring config). It checks for ngrok executable & configuration file presence.
View start_proxy.sh
#!/bin/sh
#
# Wrapper script to launch reverse proxy with local configuration
# and copy tunnel's hostname into (spring) yml configuration
#
# Created 15 december 2020 - Federico Ricchiuto <f.ricchiuto@ital.dev>
#
FILE=./ngrok
CONFIGURATION=./ngrok.yml
@funder7
funder7 / OpenStreetMap-dark_style.css
Created September 19, 2020 15:05
OpenStreetMap - Dark mode style - AlexPS
View OpenStreetMap-dark_style.css
/*
* Style obtained from https://userstyles.org/styles/173774/openstreetmap-dark-theme
* License: CC0 - Public Domain
* Author: AlexPS https://userstyles.org/users/718312
*/
@-moz-document url-prefix("https://www.openstreetmap.org")
{
::-webkit-scrollbar
{
overflow: visible;
@funder7
funder7 / README.md
Last active July 16, 2022 07:19
[WORKING] How to install Fedora Workstation 30 on Acer Switch 10 Tablet (SW5-012)
View README.md

Preparation steps

I've downloaded the tool from fedora website, which automatically downloads the os image, and creates the usb for you. Set the password in the UEFI Setup, then disabled Secure Boot, set USB to be the first drive to boot. Save and exit.

Fedora Setup

Configure keyboard layout, then I've entered the drive setup section, you have leave selected the drive, then you can choose 3 options, I've selected the middle one, it's something like "manual setup", then I decided to completely wipe the windows stuff and made the partition table (GPT) like this:

mount point - partition type - size