Skip to content

Instantly share code, notes, and snippets.

View bubba-h57's full-sized avatar

Bubba bubba-h57

View GitHub Profile
@bubba-h57
bubba-h57 / Conditionable.php
Created October 30, 2023 15:32
When/Unless Trait for PHP Objects
<?php
trait Conditionable
{
public function when($condition, $callable)
{
if ($condition) {
$callable($this, $condition);
}
return $this;
}
@bubba-h57
bubba-h57 / install.md
Last active April 24, 2024 13:28
Instructions for installing PHP Extensions sqlsrv & pdo_sqlsrv on Apple M1 ARM64 workstations.

PHP Extensions sqlsrv & pdo_sqlsrv on Apple M1 ARM64

Install brew

If you do not already have it, install brew as follows:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install the GNU make tools

brew install autoconf automake libtool
@bubba-h57
bubba-h57 / getcsvmacro.php
Last active December 5, 2022 23:11
Laravel Collection Macro for Reading a CSV file into a Collection
<?php
Collection::macro('getcsv', static function (string $file): Collection {
$resource = fopen($file, 'rb');
$result = new Collection();
$header = fgetcsv($resource);
while (($line = fgetcsv($resource)) !== false) {
$result->add($line);
}
fclose($resource);
@bubba-h57
bubba-h57 / .wslconfig
Created July 19, 2022 14:14
WSLg Configurations for Laravel PHP Development with PHPStorm and Tinkerwell
# Settings apply across all Linux distros running on WSL 2
[wsl2]
# Specify a custom Linux kernel to use with your installed distros.
# The default kernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernel
# kernel=
# Limits VM memory to use no more than 16 GB, this can be set as whole numbers using GB or MB
memory=16GB
@bubba-h57
bubba-h57 / instructions.md
Last active October 23, 2023 12:46
Configuring Jetbrains Gateway and WSL

Step 1: SSH Daemon

In your WSL instance, re-install OpenSSH server as follows.

sudo apt remove --purge openssh-server
sudo apt install openssh-server

Edit /etc/ssh/sshd_config (e.g. sudo vi /etc/ssh/sshd_config) and add the following lines to the bottom of the file. Ensure you replace WSL_ACCOUNT_NAME with your WSL2 account name.

@bubba-h57
bubba-h57 / Dockerfile
Created February 7, 2022 16:49
Modifications to the 8.0 Sail Dockerfile for more functionality as a .devcontainer.
FROM ubuntu:21.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
@bubba-h57
bubba-h57 / .php-cs-fixer.php
Created October 21, 2021 15:10
My Code Sniffer
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
/* PHP arrays should be declared using the configured syntax. */
'array_syntax' => ['syntax' => 'short'],
/* Binary operators should be surrounded by space as configured. */
@bubba-h57
bubba-h57 / phpunit.yml
Created April 29, 2020 19:37
Github Actions Continuous Integration/Testing workflow for PHP 7.4, Laravel 7, MariaDb, & Redis.
name: Laravel 7, MariaDb, & Redis CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
continuous-integration:

Keybase proof

I hereby claim:

  • I am bubba-h57 on github.
  • I am bubba (https://keybase.io/bubba) on keybase.
  • I have a public key ASCdPhM2q9ZHXatdGCzMpylJOredaPtgOItaZ6oKFkT7tQo

To claim this, I am signing this object:

@bubba-h57
bubba-h57 / start.stop.function.js
Last active September 26, 2019 16:00
So, you want a Google App Script function that will allow you to insert the current date time stamp, but then that date time stamp should not ever change again?
/**
* This is your `=START()` function.
* It will make a call to the `handleTimestamp_(propertyName)`
* Which does the real work.
*/
function START(){
SpreadsheetApp.getActiveRange().getA1Notation()
return handleTimestamp_('starttimestamep'.concat(SpreadsheetApp.getActiveRange().getA1Notation()))
}