Skip to content

Instantly share code, notes, and snippets.

@sultaniman
sultaniman / common-absinthe-error-shape.ex
Created April 28, 2019 12:23
Common Absinthe error shape
@permission_denied {
:error,
%{
message: gettext("Permission denied"),
code: :permission_denied
}
}
@sultaniman
sultaniman / declarative-schemas.py
Created November 29, 2018 10:52
Just sketching for declarative schemas
def add(field_name, type, **options):
pass
def create_index(field_name):
pass
def schema(table_name, *actions):
return DatabaseTable(table_name)
from typing import Any, Dict
from graphene_django.views import GraphQLView
from graphql.error import GraphQLError
from graph.format_error import format_error
class MyGraphQLView(GraphQLView):
@staticmethod
from typing import Dict, Any
from graphql import GraphQLError
def format_error(error: GraphQLError) -> Dict[str, Any]:
"""Extract field from ``error`` and return formatted error
:param error: GraphQLError
:return: mapping of fieldName -> error message
"""
import Vue from 'vue'
import VueApollo from 'vue-apollo'
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { GRAPHQL_ENDPOINT } from './config'
const httpLink = new HttpLink({
// You should use an absolute URL here
uri: GRAPHQL_ENDPOINT
module.exports = {
chainWebpack: config => {
config.module
.rule('graphql')
.test(/\.gql$/)
.use('graphql-tag/loader')
.loader('graphql-tag/loader')
.end()
}
}
const path = require('path')
const {
hasYarn,
IpcMessenger,
} = require('@vue/cli-shared-utils')
const chalk = require('chalk')
const { defaultValue, nullable } = require('./utils')
const DEFAULT_SERVER_FOLDER = './apollo-server'
const COMMAND_OPTIONS = {
function posix-source
for i in (cat $argv)
set arr (echo $i |tr = \n)
set -gx $arr[1] $arr[2]
end
end
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"root": {"level": "DEBUG", "handlers": ["console"]},
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s "
"%(process)d %(thread)d %(message)s"
}
},
<style lang="sass" scoped>
.upload
&__documents
border: 1px dashed #eee
border-radius: 0.2em
margin: 0.5em
padding: 1em 0 0.5em 0.5em
transition: all 0.1s ease-in
&:hover