Skip to content

Instantly share code, notes, and snippets.

View tehshane's full-sized avatar

Shane Lawrence tehshane

View GitHub Profile
@ksmithut
ksmithut / .dockerignore
Last active September 18, 2023 15:48
Node Docker Compose nodemon
node_modules
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@donmccurdy
donmccurdy / wildcard-to-regexp.js
Last active February 21, 2024 06:49
Wildcard and glob matching in JavaScript.
/**
* Creates a RegExp from the given string, converting asterisks to .* expressions,
* and escaping all other characters.
*/
function wildcardToRegExp (s) {
return new RegExp('^' + s.split(/\*+/).map(regExpEscape).join('.*') + '$');
}
/**
* RegExp-escapes all characters in the given string.
@Yimiprod
Yimiprod / difference.js
Last active April 5, 2024 13:17
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {