Skip to content

Instantly share code, notes, and snippets.

View stubailo's full-sized avatar
📈
Working on Flipturn!

Sashko Stubailo stubailo

📈
Working on Flipturn!
View GitHub Profile
@stubailo
stubailo / gist:8e321408be3f1faee8cf
Created October 9, 2014 18:24
See a very detailed list of commits from <source branch> that haven't been cherry picked onto <target branch>
git checkout <source branch>
git show --quiet $(git cherry <target branch> | cut -c 3-)
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
@stubailo
stubailo / gist:a04004c59c8acd4d108a
Created July 16, 2015 03:55
Proxy HTTP API to Meteor publication and method
// code not guaranteed to work!!!! never ran it
// On the server
Meteor.publish("myData", {
var subscription = this;
var data = HTTP.call("https://reddit.com/r/funny.json").data.children;
data.forEach(function (item) {
subscription.added("my-collection", item);
});
// http://swapi.co/api/people/schema
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of this person."
},
"birth_year": {
@stubailo
stubailo / mutations.js
Created May 17, 2016 22:37
Another example
function mapMutationsToProps({ ownProps, state }) {
return {
postReply: (raw) => ({
mutation: gql`
mutation postReply(
$topic_id: ID!
$category_id: ID!
$raw: String!
) {
...
@stubailo
stubailo / connect.js
Last active May 17, 2016 22:39
Apollo client code snippets for React+Redux post
// Works just like `react-redux` connect
import { connect } from 'react-apollo';
import Category from './category';
function mapQueriesToProps({ ownProps, state }) {
return {
category: {
query: gql`
query getCategory($categoryId: Int!) {
category(id: $categoryId) {
@stubailo
stubailo / answer.md
Last active July 12, 2016 06:46
Answer to Blaze question on Crater.io

Answer to Blaze question on crater.io

https://crater.io/comments/ucDz7fibgDcJqHtFu

Many of us want Blaze 2.0 and not Angular or React. Is MDG committed to continuing the development of Blaze? If so, how? Thanks!

TL;DR: I think the best thing to do is probably build Blaze 2.0 on top of the React rendering system to get a nice developer experience while taking advantage of new tech like React Native and the React component ecosystem.

Blaze is a very interesting part of the Meteor platform, from a platform point of view. Let's look at where we are now. Here are some of the benefits of Blaze:

@stubailo
stubailo / filter.js
Last active December 5, 2016 19:21
graphql-anywhere filter
import gql from 'graphql-tag';
import graphql from 'graphql-anywhere';
// I don't need all this stuff!
const gitHubAPIResponse = {
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
"title": "Found a bug",
"body": "I'm having a problem with this.",
"user": {
"login": "octocat",
@stubailo
stubailo / proptypes.jsx
Last active December 5, 2016 19:34
graphql-anywhere proptypes
import { propType } from 'graphql-anywhere';
const CommentView = ({ comment }) => (
<div>
<p>{ comment.content }</p>
<p>Posted by { comment.postedBy.login } on {comment.createdAt }</p>
</div>
);
CommentView.commentFragment = gql`
@stubailo
stubailo / docs.js
Created December 16, 2016 07:57
Why do all code docs tools put the doc in a separate comment instead of in the code?
// Quick idea. I love doc comments, but it's annoying that you need to repeat all of the
// argument names again, just to document them. It's easy for parameter lists to fall out
// of date. Plus, if you're using a typed language a lot of the information is already
// there. Is there a tool to parse comments like the below?
/** Create a Redux store. Using this function as a convenient example. */
function createStore(
/** A reducer function that maps the previous state and current action to the next state. */
reducer: ReducerFunction,