Skip to content

Instantly share code, notes, and snippets.

View yllieth's full-sized avatar
🇨🇦

Sylvain RAGOT yllieth

🇨🇦
View GitHub Profile
@yllieth
yllieth / arrays.js
Last active March 30, 2017 13:35
standard operations on arrays/objects
// returns elements not ends
function elementsNotEndsBy(ending, array) {
var regex = new RegExp(ending + '$');
return array.filter(entry => !regex.test(entry));
}
elementsNotEndsBy('berry', ['strawberry', 'apple', 'blueberry']); // => ['apple']
elementsNotEndsBy('allEntries', ['strawberry', 'apple', 'blueberry']); // => ['strawberry', 'apple', 'blueberry']
elementsNotEndsBy('allEntries', []); // => []
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="page">
<div id="nav-top-bar">topbar</div>
@yllieth
yllieth / gulpfile.js
Last active May 13, 2019 20:18
Cleaning generated files from ts/less compilation
const cleanGeneratedFilesBasedOn = (mapFileExtension, sourceFileExtension, otherExtensionsToDelete) => {
const debug = true;
const startTime = new Date().getTime();
if (!Array.isArray(otherExtensionsToDelete)) {
otherExtensionsToDelete = [];
}
const pattern = '{,!(node_modules)/**/}*' + mapFileExtension;
return glob(pattern, (err, files) => {
let toDelete = [];