Skip to content

Instantly share code, notes, and snippets.

View hxtree's full-sized avatar

Matthew Heroux hxtree

View GitHub Profile
@hxtree
hxtree / agile-notes.md
Last active May 4, 2022 17:13
Agile Notes

Agile Tools

Agile User Stories

Example

Write stories from the end-user's perspective. The end-user may be a external customer or internal customer. User stories also form the building blocks of agile frameworks like epics and initiatives.

As a: [user role that will be interacting with the system]

@hxtree
hxtree / wsl-docker-github-setup.md
Last active July 19, 2022 01:29
WSL Docker Github Setup
@hxtree
hxtree / codacy-checksum-verification.sh
Created February 10, 2022 21:27
Codacy Checksum Verification
# Codacy Curl Bashing Checksum Verification Script
# https://blog.aquasec.com/codecovs-breach-supply-chain-attack
SHA256=$(curl -sSL https://coverage.codacy.com/get.sh | sha256sum)
CHECKSUM='28dc671cdf1038f1c95cf2dbcb4ef6ae127a243d99d0b131d4600f8b4e3e91428 *-'
if [ "$SHA256" == "$CHECKSUM" ]; then
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r tests/log/clover.xml -l PHP
else
echo "Failed Codacy checksum verification: $SHA256"
@hxtree
hxtree / PhpStorm.desktop
Created December 20, 2021 21:37
PhpStorm Ubuntu Install
[Desktop Entry]
Name=PhpStorm
Comment=PhpStorm
Exec=/usr/local/sbin/PhpStorm/bin/phpstorm.sh
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Network;Application;
Name[en_US]=ZendStudio
@hxtree
hxtree / coding-algorithms.md
Last active April 7, 2022 14:17
Coding Algorithms
@hxtree
hxtree / gist:d3d9747cc634f6c25e47b5b5d8cdc315
Created August 3, 2021 03:25
Microservice Asynchronous Communication
# Microservice Asynchronous Communication
HTTP doesn't work well for in between asynchronous communication.
Other options include:
RabbitMQ (cloud agnostic)
https://www.rabbitmq.com/
Apache Kafka (cloud agnostic)
https://kafka.apache.org/
@hxtree
hxtree / tips-for-phpunit.md
Created June 22, 2021 13:48
Tips for PHPUnit Tests

Tips for PHPUnit Tests

Here are some tips for making PHPUnit tests:

  • Create tests before actually coding the method to ensure the method actually does what it is being tested to do.
  • In PHPStorm from within the class press ALT + INSERT to automatically create a UnitTest.
  • UnitTests should be able to run without a database.
  • Setup multiple testSuites to break unit tests into smaller packages. This also allows for UnitTests that require a database access to be separated.
  • Generate coverage reports to see the test is actually doing. Add more assertions until 100% of method is tested.
  • Add PHPUnit tests to CI to get instant feedback on PR (TravisCI, etc.). Don't count on developers running PHPUnit tests locally only.
  • Add coverage report generation to CI (TravisCI, Github Action, etc.)
  • Add coverage badge/shield and CI PHPUnit test pass badge to repo README.md.
@hxtree
hxtree / linux-find-last-modified-files.md
Created February 5, 2021 21:48
Linux Find Last Modified Files

Find files in a directory most recently modified

find $1 -type f -exec stat --format '%Y :%y %n' "{}" \; | sort -nr | cut -d: -f2- | head

Build options:

  • Jenkins Blue Ocean plugin for creating pipeline makes Jenkins easy.
  • Github Actions
  • Gitlab CI
  • TravisCI worked well open source project, but I chose to switch over to Github Actions.

Testing

Unit Tests

Test individual methods.

@hxtree
hxtree / PHP code coverage badge.md
Last active June 20, 2020 02:32
PHP code coverage badge

In PHP, the coverage stats are easily provided by PHPUnit. But adding a badge to your repo is another matter.

Coveralls.io

I found this solution to have network outages (e.g. 6/19/2020 10:25pm) and ended up with saying the branch was in a dettached head, which wasn't the case. This made the badge useless as each time the URL needed to be manually updated. The badges look nice, they don't have an icon and say simply coverage.

.coveralls.yml