Skip to content

Instantly share code, notes, and snippets.

🍑
Farting

Saad Shahd saadshahd

🍑
Farting
Block or report user

Report or block saadshahd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saadshahd
saadshahd / svg-to-icon.js
Last active Aug 7, 2017
Runtime generator not found
View svg-to-icon.js
const path = require('path');
const pascalCase = require('pascal-case');
const {stringifyRequest} = require('loader-utils');
const {stringifySymbol, stringify} = require('../../lib/utils');
module.exports = function ({symbol, config, context, loaderContext}) {
const {spriteModule, symbolModule, runtimeOptions} = config;
const compilerContext = loaderContext._compiler.context;
const iconModulePath = path.resolve(compilerContext, runtimeOptions.iconModule);
View sameCharsWords.js
function getSameCharStrings(strings) {
const repeatedCharsOrSpaceRegex = /(\w)(?=.*\1)|\s/g;
const uniqueSortedChars = strings.map(word => {
return word
.replace(repeatedCharsOrSpaceRegex, '')
.split('')
.sort()
.join('');
});
View side-effects
// Generates two conditional methods
// 1. (isBroken: true, method: 'some') filters the abandoned shipments
// 2. (isBroken: false, method: 'every') filters the ready shipments
function checkShipment(isBroken, method) {
return function (curShipment) {
return curShipment.packagesList[method](function (curPackage) {
return curPackage.isBroken === isBroken;
});
};
}
You can’t perform that action at this time.