Skip to content

Instantly share code, notes, and snippets.

View devhammed's full-sized avatar
💭
All roses are not flower, where did you put Royce?

Hammed Oyedele devhammed

💭
All roses are not flower, where did you put Royce?
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 February 6, 2024 08:19
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)
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active April 18, 2024 13:41
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);