This file contains 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
from typing import Any, Callable, Self | |
from htpy import ( | |
Element, | |
Node, | |
Iterator, | |
Attribute, | |
_id_class_names_from_css_str, | |
_kwarg_attribute_name, | |
div, | |
button, |
This file contains 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
# frozen_string_literal: true | |
require 'json' | |
module Utils | |
# Ruby Log Formatter that serves two purposes: | |
# 1. Formats logs to JSON, so that they can be indexed by our log processor (currently Datadog) | |
# 2. Enriches logs with Datadog APM trace information, so logs can be associated back to APM traces | |
class TracedJSONLogFormatter | |
def initialize |
This file contains 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
# The general idea is that similarly to lazy evaluation, the interpreter executes each resolver from inside a Fiber. | |
# Once we have instantiated a Fiber for every resolver reachable in this pass, we loop over the Fibers, yielding till | |
# they are dead (the resolver has returned). Resolvers that are not using the Fiber based Loader API would simply | |
# return there value on the first pass. | |
# Complete pseudo-cpde, I don't know GraphQL Ruby internals well | |
def main_graphql_ruby_interpreter_loop(reachable_fields) | |
unresolved_fields = reachable_fields.reduce({}) do |acc, field| | |
# Creating one Fiber per field is probably too expensive, and we'd want to re-use them across loops or even across | |
# different fields in the same loop. A topic for another time. |
This file contains 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
DEPENDENCIES | |
active_model_serializers (= 0.9.4) | |
active_record_union | |
activeadmin (~> 1.2.1) | |
acts_as_list | |
amatch | |
annotate | |
autoprefixer-rails | |
awesome_nested_set (~> 3.1.0) | |
aws-sdk-v1 |
This file contains 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
### IMPLEMENTATION ### | |
# Flattens an arbitrarily nested enumerable of enumerables. | |
# Works for Arrays of Integers, and more. | |
class EnumerableFlattener | |
attr_reader :array | |
def initialize(array) | |
@array = array | |
end |
This file contains 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
RuntimeError: Duplicate type definition found for name 'Account' at 'Field LocalChain.account's return type' (Types::AccountType, Types::AccountType) | |
from graphql/schema/traversal.rb:168:in `visit' | |
from graphql/schema/traversal.rb:205:in `visit_field_on_type' | |
from graphql/schema/traversal.rb:185:in `block in visit_fields' | |
from graphql/schema/traversal.rb:184:in `each' | |
from graphql/schema/traversal.rb:184:in `visit_fields' | |
from graphql/schema/traversal.rb:143:in `visit' | |
from graphql/schema/traversal.rb:205:in `visit_field_on_type' | |
from graphql/schema/traversal.rb:185:in `block in visit_fields' | |
from graphql/schema/traversal.rb:184:in `each' |
This file contains 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
# Assumptions | |
# 1. Your schema implements the Relay Query.node(id:) field, Schema.id_from_object, and Schema.object_from_id | |
# 2. The types you wish to test implement the Node interface | |
# 3. (In order to be compatible with Node) the object you test resolves to a single type | |
# 4. The object you wish to test has a unique identifier | |
# TODO | |
# Maybe we can remove 3. by making use of an override in context? | |
# Since Schema.resolve_type takes a context object, perhaps if you must test an object that is | |
# presented via multiple types in the schema, you can force the decision via context. I have not |
This file contains 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
# Install libgraphql parser | |
if [ ! -d $HOME/gql/usr/local/lib ] | |
then | |
wget https://github.com/graphql/libgraphqlparser/archive/v0.7.0.tar.gz | |
tar -xzvf v0.7.0.tar.gz | |
cd libgraphqlparser-0.7.0/ && cmake . && make && make DESTDIR=$HOME/gql install && cd $TRAVIS_BUILD_DIR | |
else | |
echo "libgraphqlparser install detected" | |
fi |
This file contains 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
Expected a value of type "Time" but received: 2016-12-23T05:04:10.611Z |
This file contains 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
{ | |
/* | |
// Place your snippets for JavaScript React here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected. | |
// Example: | |
"Print to console": { | |
"prefix": "log", | |
"body": [ | |
"console.log('$1');", |
NewerOlder