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 atom
Gist for my atom settings.
@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),
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 / 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 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 / 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 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 / Guidelines.md
Created Apr 9, 2016 — forked from evancz/Guidelines.md
Some thoughts on how to have nicer discussions online
View Guidelines.md

Towards Discussion Guidelines

I personally like to have discussions in the spirit of the Socratic method. Instead of declaring my opinion, I ask a relevant question. How about this situation? What about this case? This has two possible outcomes.

  1. The other person explains to me how things work in that case. I realize that I misunderstood, and we both come out enriched and in agreement.
  2. The other person realizes that those situations are not covered. They realize they misunderstood, and we both come out enriched and in agreement.

In both cases, it could have been a conflict, egos crashing together. But by asking questions, it becomes a collaboration to find the best answer. Even the simple act of asking a question in the first place says, "I care what you have to say, we can agree on this." That said, I have noticed that it is definitely still possible for things to go wrong within this framework. How can this happen?

There was a passage from [The

View class-methods-to-properties.js
module.exports = function (fileInfo, api) {
const j = api.jscodeshift;
const root = j(fileInfo.source);
return root.find(j.MethodDefinition)
.filter(method => method.value.kind !== 'constructor')
.replaceWith(method => {
const { key, value: { body, params } } = method.value;
return j.classProperty(
View stylesheet.elm
stylesheet : String -> Html.Html Msg
stylesheet link =
let
tag =
"link"
attrs =
[ Html.Attributes.attribute "rel" "stylesheet"
, Html.Attributes.attribute "property" "stylesheet"
, Html.Attributes.attribute "href" link
You can’t perform that action at this time.