Skip to content

Instantly share code, notes, and snippets.

View wit3's full-sized avatar

Salvatore Scalzi wit3

  • Salsomaggiore Terme, Emilia Romagna, Italy
  • 19:07 (UTC +01:00)
  • X @_Wit3
View GitHub Profile
@SolusCado
SolusCado / personPill.yaml
Last active July 10, 2025 13:54
A styled grid of person mushroom cards
type: custom:mod-card
card_mod:
style:
hui-grid-card$: |
div#root > hui-card > *
{ flex: initial; width: fit-content; }
div#root {
background-color: rgba(255,255,255,.1);
border-radius: 36px;
justify-content: space-around;
Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];
@xiCO2k
xiCO2k / view.blade.php
Created October 13, 2022 17:11
Infinite Image fadeIn fadeOut
<div
class="relative pointer-events-none"
x-data="{ active: 0 }"
x-init="setInterval(() =>
active = ++active > $el.childElementCount - 1 ? 0 : active
, 3000)"
>
@foreach([
'hero-pic1.webp',
'hero-pic2.webp',
@aneesdev
aneesdev / EnhancedEnum.php
Created September 19, 2022 18:59
EnhancedEnum PHP trait
<?php
trait EnhancedEnum
{
/**
* Get the enum value from the name. e.g case INVOICE = 'invoice'; will return 'invoice'
*
* @param string $name
* @return static
*/
@bezhanSalleh
bezhanSalleh / ModelResource.php
Last active July 31, 2022 23:26
Filament Dynamic UI for Role and Permissions | Toggel + Checkboxes
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Grid::make()
->schema([
Forms\Components\Card::make()
->schema([
Forms\Components\TextInput::make('name')
->required()
@ryanmortier
ryanmortier / wsl_development_environment.md
Last active July 13, 2022 11:10
WSL Development Environment

WSL Development Environment

Windows

Source: https://docs.microsoft.com/en-us/windows/wsl/install-win10

  1. Elevated PowerShell: wsl --install
  2. Reboot computer when prompted.
  3. Setup will continue automatically and install Ubuntu.
  4. Setup a user and password for Ubuntu when prompted.
  5. Install Microsoft Terminal, configure fonts and theme.
  6. Install Visual Studio Code, configure settings, keybinds, theme, and extensions.
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active October 29, 2025 11:37
Fix DNS resolution in WSL2

Permanent WSL DNS Fix (WSL 2.2.1+)

If you're encountering ping github.com failing inside WSL with a Temporary failure in name resolution, you're not alone — this has been a long-standing issue, especially when using VPNs or corporate networks.

This issue is now fixed robustly with DNS tunneling, which preserves dynamic DNS behavior and avoids limitations like WSL’s former hard cap of 3 DNS servers in /etc/resolv.conf.

DNS tunneling is enabled by default in WSL version 2.2.1 and later, meaning that if you're still seeing DNS resolution issues, the first and most effective fix is simply to upgrade WSL. Upgrading WSL updates the WSL platform itself, but does not affect your installed Linux distributions, apps, or files.

To upgrade WSL, follow these steps,

@Agoreddah
Agoreddah / encrypter.js
Last active October 2, 2024 07:13
Laravel encrypt & decrypt in Node.js
// load variables
require('dotenv').config();
// load dependencies
const crypto = require('crypto');
'use strict';
const APP_KEY = process.env.APP_KEY;
@xenogew
xenogew / Dockerfile
Last active June 4, 2025 03:42
Example of PHP 8.4 Docker image install with MS SQL Server extensions
FROM php:8.4-fpm-bookworm
WORKDIR /application
ENV ACCEPT_EULA=Y
# Fix debconf warnings upon build
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_VERSION
# LEGACY packages that ever installed when last time research of PHP 7.4,
@meigwilym
meigwilym / console.php
Last active March 5, 2024 02:20
Laravel Create User Command
<?php
// routes/console.php
// quickly create an user via the command line
Artisan::command('user:create', function () {
$name = $this->ask('Name?');
$email = $this->ask('Email?');
$pwd = $this->ask('Password?');
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
\DB::table('users')->insert([