Skip to content

Instantly share code, notes, and snippets.

View alexeyraspopov's full-sized avatar
✍️
Working on something exciting

Oleksii alexeyraspopov

✍️
Working on something exciting
View GitHub Profile
var slice = Array.prototype.slice;
function curry(f){
var n = f.length;
return function curried(as){
return function(){
var args = as.concat(slice.call(arguments))
return args.length < n ? curried(args) : f.apply(null, args);
@alexeyraspopov
alexeyraspopov / links.md
Created December 6, 2014 18:15
Полный список ссылок к докладу о функциональном программировании на WSD 2014
'use strict';
function unsubscribe(subscribers, callback){
return function(){
var index = subscribers.indexOf(callback);
if(index > -1){
subscribers.splice(index, 1);
}
};
function View(props) {
return (
props.allow
? HelloWorld({ name: props.name })
: P(null, [Text('Not allowed')])
);
}
function HelloWorld(props) {
return (
function transform(options) {
return function(k, v) {
return options.hasOwnProperty(k) ? options[k](v, k) : v;
};
}
var Filter = {};
Filter.ELEMENT = 1
Filter.TEXT = 2
Filter.COMMENT = 4;
const INCREMENT = 'INCREMENT', DECREMENT = 'DECREMENT';
function reducer(state, action) {
switch (action.type) {
case INCREMENT:
return state + 1;
case DECREMENT:
return state - 1;
}
}
// https://developer.mozilla.org/ru/docs/Web/API/ValidityState
var validityState = { valid: false, stepMismatch: true, tooLong: false };
function errorMessage(validity) {
// Constant goes in expression
switch (true) {
// Variable goes in a case clause
case !validity.valid:
return 'is not a Number';
case validity.stepMismatch:
Maybe(13)
.bind(a => a * a)
.bind(log);
isWorthy("Loki")
.bind(null, () => Just("Vision"))
.bind(name => log(name, "is worthy"));
function isWorthy(name) {
return name === "Thor" ? Just(name) : Nothing();
@alexeyraspopov
alexeyraspopov / README.md
Last active September 22, 2015 15:16
Transmit nextProps issue

Steps to reproduce

  1. Clone this gist git clone git@gist.github.com:7ac0d01dc7fdbecaab69.git && cd 7ac0d01dc7fdbecaab69
  2. Install dependencies npm install
  3. Start project npm start
  4. Open http://localhost:8000 in your browser
  5. Click on any item in projects list

Expected: models list will have one item