Skip to content

Instantly share code, notes, and snippets.

@jherax
jherax / arrayFilterFactory.1.ts
Last active July 18, 2024 15:02
Filters an array of objects with multiple match-criteria.
type FilterOperator = 'AND' | 'OR';
type FiltersBy<T> = {
[K in keyof T]?: (value: T[K]) => boolean;
};
/**
* Factory function that creates a specialized function to filter
* arrays, by validating all filters (AND operator),
* or validating just one of the filters (OR operator).
* @param operator Method to validate all filters: AND, OR
@tristanisfeld
tristanisfeld / browsersync.js
Last active November 10, 2023 23:58
Gulp 4 - Multifile tasks w/ external config. Basic gulpfile template for use with multiple task files, using gulp-load-plugins
// =========================================================
// Gulp Task: browsersync
// NOTE: Using gulp v4
// Description: Sync sass, typescript, html, and browser
// using external config or add modify src
// npm install --save-dev browser-sync gulp-typescript gulpjs/gulp.git#4.0 gulp-load-plugins
// Options: node-sass gulp-sass || gulp-ruby-sass
// =========================================================
var config = require('../config.js');
var browserSync = require('browser-sync').create();
@joyrexus
joyrexus / README.md
Last active June 19, 2024 09:35 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})