Skip to content

Instantly share code, notes, and snippets.

View devhammed's full-sized avatar
💭
Changing the world, one dollar sign in my PHP code at a time!

Hammed Oyedele devhammed

💭
Changing the world, one dollar sign in my PHP code at a time!
View GitHub Profile
@randercarlos
randercarlos / LaravelWhereLikeMacro.php
Created November 26, 2023 14:11 — forked from MrPunyapal/LaravelWhereLikeMacro.php
Laravel Custom 'whereLike' Macro for Dynamic 'LIKE' Searches including relationships
<?php
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
class AppServiceProvider extends ServiceProvider
{
// ...
@simonminton
simonminton / CountryCodes.swift
Last active October 26, 2023 12:41
Countries with Names, Emoji Flags, ISO Code and Dial Codes for Swift
//
// CountryCodes.swift
// Created by Simon Minton on 26/10/2023.
//
import Foundation
struct Country: Identifiable, Hashable {
let id = UUID()
let name: String
@GeeLeonidas
GeeLeonidas / disable-agc-pipewire.sh
Last active October 26, 2024 21:10
Globally disables Auto Gain Control on PipeWire-based systems
#!/bin/bash
# Backups the previous configuration (optional if you take system snapshots regularly)
BACKUP_PATH="/usr/share/alsa-card-profile/mixer/paths_backup"
[ ! -d $BACKUP_PATH ] && sudo cp -vR /usr/share/alsa-card-profile/mixer/paths $BACKUP_PATH
# The actual Perl script that disables AGC
sudo perl -pi -0 -e 's/(\[[A-Za-z ]*Mic Boost\][A-Za-z._=\s-]+volume *= *)merge/\1zero/g;' /usr/share/alsa-card-profile/mixer/paths/*
# Shows the changes made to the system (optional)
@umutyerebakmaz
umutyerebakmaz / laravel-websockets-ssl-lets-encrypt-certbot-supervisor-ubuntu.md
Last active October 25, 2024 12:52
Laravel-Websockets Deploy Nginx Virtualhost with SSL

Laravel-websockets, SSL Certificate, Let's Encrypt, Certbot, Supervisor, Digitalocean Ubuntu

I did two days work to run laravel-websockets on my server. It will be nice to share with you.

Steps

Step1 - Laravel Websockets Installation with composer

Laravel WebSockets can be installed via composer:

@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active October 19, 2024 18:33
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@bhays
bhays / acf-page-by-template.php
Last active January 31, 2022 11:32
ACF extension to select pages by specified page template only. Include file in functions.php
<?php
function include_field_types_acf_pages_by_template( $version ) {
include_once('acf-pages-by-template.php');
}
add_action('acf/include_field_types', 'include_field_types_acf_pages_by_template');
// exit if accessed directly
if( ! defined( 'ABSPATH' ) ) exit;
// check if class already exists
@james2doyle
james2doyle / slugify.php
Last active January 12, 2022 13:19
Simple slugify function for PHP. Creates a slug for the passed string, taking into account international characters as well.
<?php
function slugify($string, $replace = array(), $delimiter = '-') {
// https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Utils/Slug.php
if (!extension_loaded('iconv')) {
throw new Exception('iconv module not loaded');
}
// Save the old locale and set the new locale to UTF-8
$oldLocale = setlocale(LC_ALL, '0');
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);