Skip to content

Instantly share code, notes, and snippets.

View mallardduck's full-sized avatar
🦑
Rockin the suburbs

Dan mallardduck

🦑
Rockin the suburbs
View GitHub Profile
/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
* @return \Illuminate\Auth\UserInterface|null
*/
public function retrieveById($identifier)
{
if ($entries = $this->searchLdap($identifier)) {
if (Config::get('l4-openldap::use_db')) {
@mallardduck
mallardduck / _font-montserrat.css
Created November 8, 2017 18:12
Old Montserrat Font Family File
/* latin */
@font-face {
font-family: 'Montserrat';
font-style: italic;
font-weight: 300;
src: local('Montserrat Light Italic'), local('Montserrat-LightItalic'), url(https://fonts.gstatic.com/s/montserrat/v10/zhwB3-BAdyKDf0geWr9Ft04GofcKVZz6wtzX_QUIqsI.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
@font-face {
@mallardduck
mallardduck / php-serenata.sh
Created May 28, 2018 22:27
A simple bash script that ensures Xdebug is not loaded. May only work on Arch Linux as PHP configurations are OS dependant.
#!/usr/bin/env bash
`which php` -n \
-c /etc/php/php.ini \
"$@";
@mallardduck
mallardduck / bay-thumb.svg
Last active July 10, 2018 13:46
Statewide Regions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mallardduck
mallardduck / OutputPrefixTrait.php
Last active October 18, 2018 20:56
A PHP trait for use in Laravel console commands to enable output prefixing via a command flag. Uses the `time()` a command starts at to add a unique identifier for distinguishing each invocation in logs.
<?php
namespace App\Console\Commands;
trait OutputPrefixTrait
{
/**
* The string used to prefix command output.
*
@mallardduck
mallardduck / XhguiValetDriver.php
Created December 11, 2018 16:41
A valet driver for the Xhgui tool
<?php
class XhguiValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@mallardduck
mallardduck / functions-mu-encryption.php
Created April 24, 2019 14:21 — forked from muhammad-naderi/functions-mu-encryption.php
Wordpress encrypt usermeta data database
<?php
/**
* Created by PhpStorm.
* User: Muhammad
* Date: 05/07/2016
* Time: 01:20 PM
*/
add_filter('get_user_metadata', 'decrypt_user_meta',10,4);
@mallardduck
mallardduck / email_jail
Last active February 15, 2020 23:09
An Exim System Filter to create a Domain Jail for Emails
# Block example.com from sending to any other domain
if first_delivery
and ("$h_from:" contains "@example.com")
and ("$h_to:" matches "@(?!example.com)[a-z0-9_.]+")
or ("$h_cc:" matches "@(?!example.com)[a-z0-9_.]+")
or ("$h_bcc:" matches "@(?!example.com)[a-z0-9_.]+")
then
headers add "X-Org-Subject: $h_subject"
headers remove Subject
headers add "Subject: EmailJail'd: $h_x-org-subject"
@mallardduck
mallardduck / checkSession.php
Last active March 27, 2020 01:33 — forked from lukas-buergi/checkSession.php
Check whether sessions work in php
<?php
error_reporting( E_ALL );
ini_set( 'display_errors', 1);
define('TEST_KEY', 'test');
define('TEST_VAL', 'test42');
$fileName = basename(__FILE__);
@mallardduck
mallardduck / TextFileStream.php
Last active December 15, 2020 05:08
TextFileStream - An implementation of the Parsica Stream interface for text files.
<?php
namespace MallardDuck\ConfigParser;
use Verraes\Parsica\Internal\EndOfStream;
use Verraes\Parsica\Internal\Position;
use Verraes\Parsica\Internal\TakeResult;
use Verraes\Parsica\Stream;
class TextFileStream implements Stream