Skip to content

Instantly share code, notes, and snippets.

View matthewbdaly's full-sized avatar

Matthew Daly matthewbdaly

View GitHub Profile
@matthewbdaly
matthewbdaly / FeatureContext.php
Last active February 11, 2017 21:53
Integrate Behat with Laravel 5.4
<?php
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Tests\TestCase;
use Behat\Behat\Tester\Exception\PendingException;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use App\User;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
@matthewbdaly
matthewbdaly / phpcs.xml
Created September 23, 2017 12:53
Catch var_dump(), die() or dd() with PHP CodeSniffer, as well as enforcing PSR2 and various comment standards
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>Coding standard for a Laravel app.</description>
<file>app</file>
<file>tests</file>
<exclude-pattern>*/migrations/*</exclude-pattern>
@matthewbdaly
matthewbdaly / addresses.py
Created August 8, 2018 13:58
Expand a list of IP addresses with Python 3
from ipaddress import ip_network
ip_ranges = [
'192.168.1.0/24',
@matthewbdaly
matthewbdaly / init.vim
Last active January 31, 2024 16:34
My NeoVim config
let g:polyglot_disabled = ['markdown']
call plug#begin()
" Project
Plug 'ahmedkhalf/project.nvim'
" Search
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
@matthewbdaly
matthewbdaly / SimpleTestCase.php
Created October 5, 2018 08:36
PHPUnit custom assertion for checking a string is a valid UUID
<?php
namespace Tests;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use PHPUnit\Framework\TestCase as BaseTestCase;
class SimpleTestCase extends BaseTestCase
{
use MockeryPHPUnitIntegration;
@matthewbdaly
matthewbdaly / App.js
Created June 12, 2020 23:08
useFetch
//@flow
import React from 'react';
import useFetch from './Hooks/useFetch';
import marked from 'marked';
import './App.css';
type Data = {
posts: Array<{
title: string,
slug: string,
@matthewbdaly
matthewbdaly / init.lua
Last active August 22, 2023 07:54
Lua version of my Neovim config
vim.g.polyglot_disabled = 'markdown'
local Plug = vim.fn['plug#']
vim.call('plug#begin')
--Project
Plug('ahmedkhalf/project.nvim')
--Search
Plug('junegunn/fzf', {['do'] = vim.fn['fzf#install']})
Plug('junegunn/fzf.vim')
@matthewbdaly
matthewbdaly / gist:6ae0059c9e86cf97523419474fed4e46
Created July 30, 2022 13:32
How I got PHPBrew working on Mac OS Monterey on M1 silicon
export OPENSSL_PREFIX=$(brew --prefix [email protected])
export OPENSSL_CFLAGS="-I${OPENSSL_PREFIX}/include"
export OPENSSL_LIBS="-L${OPENSSL_PREFIX}/lib -lcrypto -lssl"
phpbrew --debug install -j 12 8.1 +default -- --with-openssl="shared,${OPENSSL_PREFIX}" --without-pcre-jit
@matthewbdaly
matthewbdaly / .vimrc
Last active November 2, 2022 15:27
My older vim config, for working with PHP 7.1 when necessary
let g:polyglot_disabled = ['markdown']
call plug#begin()
" NERDTree
Plug 'preservim/nerdtree'
" Git integration
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
@matthewbdaly
matthewbdaly / pipeline.json
Last active May 19, 2023 16:31
Ingest pipeline for Apache logs with GeoIP
{
"description": "Ingest pipeline created by text structure finder",
"processors": [
{
"grok": {
"field": "message",
"patterns": [
"\\[%{HTTPDATE:timestamp}\\] .*?%{GREEDYDATA:domain_name}:%{NUMBER:port} .*?%{IP:ipaddress}.*? .*? .*? .*?%{QUOTEDSTRING:request} %{INT:status_code} %{INT:size} %{QUOTEDSTRING:referrer} %{QUOTEDSTRING:user_agent}"
],
"ecs_compatibility": "v1"