![]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define an instrumentation that performs the caching | |
| class CachingInstrumentation | |
| def instrument(_type, field) | |
| return field unless field.metadata.include?(:cache_proc) | |
| old_resolver = field.resolve_proc | |
| new_resolver = -> (obj, args, ctx) do | |
| # Get the caching key | |
| cache_key = field.metadata[:cache_proc].call(obj, args, ctx) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define an instrumentation that performs the caching | |
| class CachingInstrumentation | |
| def instrument(_type, field) | |
| return field unless field.metadata.include?(:cache_proc) | |
| old_resolver = field.resolve_proc | |
| new_resolver = -> (obj, args, ctx) do | |
| # Get the caching key | |
| cache_key = field.metadata[:cache_proc].call(obj, args, ctx) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Monkey Patch: Add a count field to all connections by default. | |
| # Note, I tried to make this nicer, where it would just call the original method and then add a count field, | |
| # but the challenge outlasted my patience. So I just replaced the whole method. TODO: better way to do this | |
| module GraphQL | |
| module Relay | |
| module ConnectionType | |
| def self.create_type(wrapped_type, edge_type: wrapped_type.edge_type, edge_class: GraphQL::Relay::Edge, nodes_field: ConnectionType.default_nodes_field, &block) | |
| custom_edge_class = edge_class | |
| # Any call that would trigger `wrapped_type.ensure_defined` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| query IntrospectionQuery { | |
| __schema { | |
| queryType { name } | |
| mutationType { name } | |
| types { | |
| ...FullType | |
| } | |
| directives { | |
| name | |
| description |
To Login
ssh -i <private-key-file/pem> ec2-user@[ec2-hostname].amazonaws.com- Install Node JS & pm2 Ref:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
| * It was requested to be introduced at as part of the jsonwebtoken library, | |
| * since we feel it does not add too much value but it will add code to mantain | |
| * we won't include it. | |
| * | |
| * I create this gist just to help those who want to auto-refresh JWTs. | |
| */ | |
| const jwt = require('jsonwebtoken'); |
OlderNewer
