Skip to content

Instantly share code, notes, and snippets.

View leeovery's full-sized avatar
🎯
Focusing

Lee Overy leeovery

🎯
Focusing
View GitHub Profile
@leeovery
leeovery / aws_create_users_ubuntu.sh
Created March 10, 2022 13:51 — forked from vasansr/aws_create_users_ubuntu.sh
AWS User Data Script to create users when launching an Ubuntu server EC2 instance
#!/bin/bash
#
# Initial script to create users when launching an Ubuntu server EC2 instance
#
declare -A USERKEY
#
# Create one entry for every user who needs access. Be sure to change the key to their
@leeovery
leeovery / sample.png
Created March 11, 2022 09:27 — forked from jirutka/sample.png
Nested numbered list with correct indentation in CSS. Live example at http://jsfiddle.net/a84enL8k/.
sample.png
@leeovery
leeovery / magic-methods.js
Created April 25, 2024 13:58 — forked from loilo/magic-methods.js
PHP Magic Methods in JavaScript
function magicMethods (clazz) {
// A toggle switch for the __isset method
// Needed to control "prop in instance" inside of getters
let issetEnabled = true
const classHandler = Object.create(null)
// Trap for class instantiation
classHandler.construct = (target, args, receiver) => {
// Wrapped class instance
@leeovery
leeovery / # Testing Laravel Validation.md
Last active January 30, 2025 14:53
Testing Laravel Validation

Testing Laravel Validation

Register the macro in a service provider or use the MacroServiceProvider to keep things tidy. Be sure to register it in the array in the /bootstrap/providers.php file.

You can then use the test example to “use” a dataset to run through your validation rules.

It will execute each item in the dataset, building the request for the provided parameter and the (incorrect) value, and then assert that the error is as expected.

If the validation fails to run, the error will not be found, and the test will fail. Similarily, if the error message changes, the test will fail.