Skip to content

Instantly share code, notes, and snippets.

View ell46and2's full-sized avatar

Elliot Alderton ell46and2

  • Cheltenham, UK
View GitHub Profile
@ell46and2
ell46and2 / filterArray.js
Created December 28, 2023 14:00 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@ell46and2
ell46and2 / AppServiceProvider.php
Created June 16, 2018 12:51 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()