Skip to content

Instantly share code, notes, and snippets.

View atom
Gist for my atom settings.
gyzerok / QueryBuilder.js
Last active Feb 4, 2020
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;
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 =, i) =>
[streams[i], callbacks[i]]
return Observable.concat(
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 / snippets.cson
Created Jun 26, 2015
my atom snippets
View snippets.cson
'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 / 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$ ='.decrement').events('click').map(_ => -1);
const increments$ ='.increment').events('click').map(_ => +1);
return Observable.merge(increments$, decrements$)
gyzerok /
Last active Nov 28, 2016
Thoughts on implementing GraphQL in Elm

GraphQL in Elm

Before going down to some problem statement and requirement I'd like to tell you what makes Elm for me a better choice upon JavaScript and why I moving towards adopting it for productions usage.

I can make some changes in my codebase, run elm-make and see all the places where I should do subsequent changes. Statically. Ave compiler and static types!

The goal of this paper is to describe why proposition of using different types for different queries would result in almost the same pitfalls I have in JavaScript with GraphQL.


gyzerok /
Created Apr 9, 2016 — forked from evancz/
Some thoughts on how to have nicer discussions online

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