Skip to content

Instantly share code, notes, and snippets.


Eloy Durán alloy

View GitHub Profile
View gist:7e398a8769bf00536f13acc072fc3403

In our application, we have a need to wrap Apollo Client, amongst other reasons we do this to pass default link context to operations. This works well for operations originating from the top-level APIs, but it doesn't for the subscribeToMore function that gets created by useQuery.

We could augment useQuery further and also wrap each subscribeToMore function object that's created, but it struck us that the relationship between the useQuery invocation and the created subscribeToMore function might actually imply that it should inherit the link context of the useQuery invocation. Below you can find a naive patch that does this.

// src/core/ObservableQuery.ts  

public subscribeToMore< 
      TSubscriptionData = TData, 
alloy / Pure vs Fragmentized Component Trees and Propagated vs Connected Data Propagation.svg
Last active Aug 30, 2021
I’ve been drawing up an overview of pure vs GraphQL fragmentized [React] UI components, different ways to propagate data through the tree, and the associated maintenance/performance considerations.
View Pure vs Fragmentized Component Trees and Propagated vs Connected Data Propagation.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
alloy / LiveQueryPolyfill.ts
Last active Feb 24, 2021
Rewrite GraphQL Live Query to subscription.
View LiveQueryPolyfill.ts
* This is a Live Query polyfill, as graphql-js does not strictly have support for that. Instead, we leave it up to the
* client to recognize a Live Query is requested with the `@live` directive on a `query` operation and here we
* transform it into a `live` subscription instead.
* Consider a schema like the following:
* ```graphql
type Badge {
id: ID!
View 1 - schema.graphql
scalar Date
type Query {
badge: Badge!
type Badge {
key: BadgeKey!
text: String!
history: BadgeHistoryConnection!
View glob.json
alloy / build-settings.rb
Created Apr 28, 2020
Example of ways to introspect Xcode build settings
View build-settings.rb
# gem install xcodeproj claide hashdiff
require 'xcodeproj'
require 'claide'
require 'pp'
argv =
project_path = argv.shift_argument
target_name = argv.option("target")
target_type = argv.option("target-type", "PBXNativeTarget")
View dump-target-build-settings.rb
require 'xcodeproj'
require 'pp'
unless (project_path = ARGV[0]) && (target_name = ARGV[1])
raise "Usage: ruby #{__FILE__} path/to/the.xcodeproj target-name [diff-base-config]"
project =
target = project.targets.find { |t| == target_name }
alloy / stderr.txt
Last active Feb 28, 2020
v0.62.0-rc.3 CHANGELOG
View stderr.txt
~/C/R/r/releases [changelog-fixes] » yarn generate -b v0.61.5 -c v0.62.0-rc.3 -r ../../react-native -f ./ -t [GITHUB-TOKEN]
Resolve base commit
Fetch commit data
View update-changelog.js
const fs = require("fs");
const PromisePool = require("@supercharge/promise-pool");
const { git, getOriginalCommit } = require("./scripts/changelog-generator");
const gitDir = "/Users/eloy/Code/ReactNative/react-native/.git"
const seen = new Map()
const SHAs = new Set()
const existingChangelogData = fs.readFileSync("./", "utf8");
alloy / Podfile
Last active Feb 28, 2020
Example of a Podfile that builds React Native without integrating into an app
View Podfile
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
install! 'cocoapods', :integrate_targets => false
platform :ios, '9.0'
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"