Skip to content

Instantly share code, notes, and snippets.

View djindjic's full-sized avatar

Aleksandar Djindjic djindjic

  • Belgrade, Serbia
View GitHub Profile
@ivan-nikitovic
ivan-nikitovic / map.js
Last active November 2, 2017 20:35
Redux - Map array with conditional modification
const map = array => ({
when: condition => ({
then: modification => array.map(
(item, index, collection) => condition(item, index, collection) ? modification(item, index, collection) : item,
),
}),
});
map([1, 2, 3]).when(number => number > 1).then(number => number * 2) // [1, 4, 6]
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@WebReflection
WebReflection / Object.getOwnPropertyDescriptors.js
Created March 3, 2014 01:39
A plural ES5 + ES6 friendly version of Object.getOwnPropertyDescriptor
'getOwnPropertyDescriptors' in Object || (
Object.getOwnPropertyDescriptors = function (Object) {
var
gOPD = Object.getOwnPropertyDescriptor,
gOPN = Object.getOwnPropertyNames,
gOPS = Object.getOwnPropertySymbols,
gNS = gOPS ? function (object) {
return gOPN(object).concat(gOPS(object));
} :
gOPN,
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>