Skip to content

Instantly share code, notes, and snippets.

Fedor Nezhivoi gyzerok

Block or report user

Report or block gyzerok

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
View cycle-example.js
function Counter(responses) {
return view(model(intent(responses)));
}
function intent({ DOM }) {
const decrements$ = DOM.select('.decrement').events('click').map(_ => -1);
const increments$ = DOM.select('.increment').events('click').map(_ => +1);
return Observable.merge(increments$, decrements$)
}
@gyzerok
gyzerok / slim-redux.js
Created Sep 24, 2015 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
View resolveMiddleware.jsx
/*
export default new GraphQLObjectType({
name: 'User',
description: 'A user',
fields: () => ({
first_name: {
type: GraphQLString,
description: 'The first name of the user.'
},
email: {
@gyzerok
gyzerok / snippets.cson
Created Jun 26, 2015
my atom snippets
View snippets.cson
'.source.jsx':
'React view template':
'prefix': 'react'
'body': """
/* @flow */
import React, { Component } from 'react';
export default class $1 extends Component {
render() {
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@gyzerok
gyzerok / rx.update.js
Last active Aug 29, 2015
Bacon.update implementation in Rx
View rx.update.js
import { Observable } from 'rx';
function update(initial: any, ...patterns: Array<any>): Observable {
const streams = patterns.filter((_, i) => i % 2 === 0);
const callbacks = patterns.filter((_, i) => i % 2 !== 0);
const pairs = streams.map((_, i) =>
[streams[i], callbacks[i]]
);
return Observable.concat(
Observable.return(initial),
@gyzerok
gyzerok / QueryBuilder.js
Last active Apr 3, 2018
RxJS MongoDB Query Builder
View QueryBuilder.js
/* @flow */
import { Observable, Disposable, ReplaySubject } from 'rx';
import mongo from 'mongodb';
import { dbUrl } from './config';
import { assign } from 'lodash';
class QueryBuilder {
_db$: Observable;
_selectors: Object;
View atom
Gist for my atom settings.
You can’t perform that action at this time.