Skip to content

Instantly share code, notes, and snippets.

@dotansimha
dotansimha / package.json
Last active June 19, 2019 12:55
GraphQL Codegen Apollo-Android
{
"name": "java-app",
"scripts": {
"postinstall": "graphql-codegen"
},
"dependencies": {
"graphql": "14.2.1",
"@graphql-codegen/cli": "1.2.2-beta.0",
"@graphql-codegen/java-apollo-android": "1.2.2-beta.0"
}
{
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null,
"types": [
type User {
profilePicture: String
}
type Mutation {
uploadProfilePicture(image: File!): User
}
const fetch = require('node-fetch');
const fs = require('fs');
fetch(`http://localhost:3002/graphql`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
variables: {},
operationName: '',
query: `
@dotansimha
dotansimha / app.ts
Last active April 1, 2020 07:32
GraphQL Modules Example
import { GraphQLModule } from '@graphql-modules/core';
import { UserModule } from './user-module';
import { ChatModule } from './chat-module';
export const appModule = new GraphQLModule({
imports: [
UserModule,
ChatModule,
],
});
@dotansimha
dotansimha / index.js
Created October 10, 2017 15:34
requirebin sketch
const { ApolloClient, createNetworkInterface } = require('apollo-client');
const gql = require('graphql-tag');
const { makeExecutableSchema } = require('graphql-tools');
const { find, filter } = require('lodash');
const { execute } = require('graphql');
// Schema
const typeDefinitions = `
type Author {
@dotansimha
dotansimha / cursor-to-observable.ts
Created July 27, 2016 19:35
Meteor MiniMongo Cursor to RxJS Observable
import { Mongo } from 'meteor/mongo';
import {Observable, Subscriber} from "rxjs";
function toObservable<T>(cursor : Mongo.Cursor<T>) : Observable<T> {
return Observable.create((observer : Subscriber) => {
const handleChange = () => {
observer.next(cursor.fetch());
};
let handler = cursor.observe({
@dotansimha
dotansimha / pipes_examples.js
Last active February 20, 2016 11:59
Pipes examples for Uri
// app.ts
@Component({})
@View({})
class Main {
myData : Mongo.Cursor<any>;
constructor() {
this.myData = MyCollection.find({});
}
}
@dotansimha
dotansimha / meteor-package-publisher-for-angular
Last active August 29, 2015 14:24
meteor-package-publisher for all AngularJS packages for specific version
var MeteorPublisher = require('./lib/publisher');
var _ = require('lodash');
var version = '1.4.2'; // bower version
var depVersion = "1.4.2"; // atmosphere version
var packages = ['angular-animate', 'angular-sanitize', 'angular-touch', 'angular-scenario', 'angular-route', 'angular-resource', 'angular-mocks', 'angular-loader', 'angular-cookies', 'angular-messages','angular-aria']; // sub-packages, will depend on the original angular:angular package
var runNextPackage;
var basePackage = {