Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Krzysztof Nowak KMNowak

🎯
Focusing
Block or report user

Report or block KMNowak

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
@KMNowak
KMNowak / 1_algorithmic_task.ts
Created Dec 13, 2019
1_algorithmic_task.ts
View 1_algorithmic_task.ts
// Write a function that receives two sequences:
// A and B of integers and returns one sequence C.
// Sequence C should contain all elements from sequence A (maintaining the order)
// except those, that are present in sequence B p times, where p is a prime number.
// Example:
// A=[2,3,9,2,5,1,3,7,10]
// B=[2,1,3,4,3,10,6,6,1,7,10,10,10]
// C=[2,9,2,5,7,10]
View medium-function-composition-3.js
const applyPlusOne = anotherFunction => prop => {
console.log(`In applyPlusOne, prop: ${prop}`)
return anotherFunction(prop + 1)
}
const applyMultiplyByTen = anotherFunction => prop => {
console.log(`In applyMultiplyByTen, prop: ${prop}`)
return anotherFunction(prop * 10)
View medium-function-composition-2.js
const addTwo = prop => {
console.log(`In addTwo, prop: ${prop}`)
return prop + 2
}
const addTen = prop => {
console.log(`In addTen, prop: ${prop}`)
return prop + 10
}
View medium-function-composition-1.ts
const addTwo = prop => {
console.log(`In addTwo, prop: ${prop}`)
return prop + 2
}
const addTen = prop => {
console.log(`In addTen, prop: ${prop}`)
return prop + 10
}
@KMNowak
KMNowak / promiseArrayResolve.js
Created Oct 10, 2017
Resolving array of promises
View promiseArrayResolve.js
const getProductImagesByIds = productImagesIds =>
Promise.all(productImagesIds.map(PROMISE_TO_SOLVE_WITH_ID_FROM_ARRAY))
.then(results => Array.isArray(results) ?
results.reduce((acc, row) => [...acc, row.url], []) :
[results]
)
.catch(e => {
throw new Error(e)
})
You can’t perform that action at this time.