Skip to content

Instantly share code, notes, and snippets.

View PaulGiletich's full-sized avatar

Pavel Giletich PaulGiletich

  • EPAM; Cox Automotive
  • Warsaw, Poland
  • 18:16 (UTC +02:00)
View GitHub Profile
@PaulGiletich
PaulGiletich / curry.js
Last active December 30, 2015 08:59
curry is a function that returns function with first arguments pre-assigned to it. Arguments stored in closure
Function.prototype.curry = function () {
if (arguments.length<1) {
return this;
}
var _this = this;
var _args = Array.prototype.slice.call(arguments);
return function() {
return _this.apply(this, _args.concat(Array.prototype.slice.call(arguments)));
}
}
@PaulGiletich
PaulGiletich / intersectRangeArrays.ts
Created June 5, 2018 17:01
get intersection of 2 arrays of ranges
export type Range = [number, number];
export const intersectRangeArrays = (arrA: Range[], arrB: Range[]): Range[] => {
let result = [];
let aLength = arrA.length;
let bLength = arrB.length;
let ai = 0;