Skip to content

Instantly share code, notes, and snippets.

View mrunknown0001's full-sized avatar

Adam mrunknown0001

  • Philippines
  • 01:40 (UTC +08:00)
View GitHub Profile
@mrunknown0001
mrunknown0001 / CustomerHelpers.php
Created August 5, 2025 02:01
Laravel reusable customer helper functions.
<?php
// Don't forget to autoload this in composer.json or create a service provider
if (!function_exists('generate_username')) {
/**
* Generate a unique username from email or name
*/
function generate_username($input, $model = 'App\Models\User', $column = 'username')
{
// Extract base from email or clean the name
@mrunknown0001
mrunknown0001 / ubuntu_debian_server_security_setup.md
Created July 22, 2025 04:11
Ubuntu/Debian Server Security Setup

Ubuntu/Debian Server Security Setup Guide

Prerequisites

  • Fresh Ubuntu/Debian server installation
  • Root or sudo access
  • Basic familiarity with command line

Step 1: Initial System Update

@mrunknown0001
mrunknown0001 / HowToUse.md
Last active July 16, 2025 23:18
Laravel Livewire NotificationHelper Trait and NotificationService for php-flasher

Example How to Use

<?php

namespace App\Http\Controllers;

use App\Traits\NotificationHelper;
use App\Services\NotificationService;

Cloudflare Tunnels Setup Guide for Ubuntu

Overview

Cloudflare Tunnels provide a secure way to expose your local services to the internet without opening ports 80/443 on your firewall. Traffic flows through Cloudflare's network directly to your services via an encrypted tunnel.

Prerequisites

  • Ubuntu server
  • Cloudflare account with a domain added
  • Admin/sudo access on your server
@mrunknown0001
mrunknown0001 / a Laravel Helper.md
Last active August 30, 2025 04:59
Laravel helper file that contains common functions

How to Use the Gist in Laravel:

  1. Save the Gist as helpers.php.

  2. Place the file in the app/Helpers directory (create the directory if it doesn't exist).

  3. Add the following line to your composer.json file to autoload the helpers:

"autoload": {
 "files": [
@mrunknown0001
mrunknown0001 / ClearOptimize.php
Last active July 16, 2025 23:22
Custom Console for Automated Optimization of Laravel Application
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
class ClearOptimize extends Command
{
/**