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-)
@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);
});
# 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 / 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 / discourse-routes
Created March 1, 2016 21:51
Output of `rake routes` for Discourse 3/1/2016
Prefix Verb URI Pattern Controller#Action
GET|POST /404(.:format) exceptions#not_found
GET /404-body(.:format) exceptions#not_found_body
sidekiq_web /sidekiq Sidekiq::Web
logster_web /logs Logster::Web
live_post_counts_about_index GET /about/live_post_counts(.:format) about#live_post_counts
about_index GET /about(.:format) about#index
// http://swapi.co/api/people/schema
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of this person."
},
"birth_year": {
@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 / 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 / graphql-subscriptions.js
Last active October 12, 2020 22:40
A very basic demo of GraphQL subscriptions with the graphql-subscriptions package
// npm install graphql graphql-tools graphql-subscriptions
const { PubSub, SubscriptionManager } = require('graphql-subscriptions');
const { makeExecutableSchema } = require('graphql-tools');
// Our "database"
const messages = [];
// Minimal schema
const typeDefs = `
type Query {
@stubailo
stubailo / graphql-subscriptions-client.js
Created October 2, 2016 16:51
Use subscriptions-transport-ws to run a GraphQL subscription from a JavaScript client.
// To run this code yourself:
// 1. Download and run the demo server: https://github.com/apollostack/frontpage-server
// 2. Use create-react-app to create a build system
// 3. npm install subscriptions-transport-ws
// 4. Replace all of the code in src/ with just this file
import { Client } from 'subscriptions-transport-ws';
const client = new Client('ws://localhost:8090');