Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mateu Aguiló Bosch e0ipso

🏠
Working from home
View GitHub Profile
@e0ipso
e0ipso / contenta.gql
Last active Oct 12, 2018
Example schema with auto-resolvers from OpenAPI definitions
View contenta.gql
type Recipe {
id: String!
title: String!
author: User!
}
type User {
id: String!
name: String!
recipes: [Recipe]
}
@e0ipso
e0ipso / uuid-setter.php
Created Mar 11, 2017
Allow setting the UUID from the front-end
View uuid-setter.php
<?php
/**
* Implements hook_entity_property_info_alter().
*/
function mymodule_entity_property_info_alter(&$info) {
// Add the uuid setter if not present.
foreach (entity_get_info() as $entity_type => $entity_info) {
if (
!empty($entity_info['uuid'])
View JSON API Fancy Filters.md

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

The JSON API specification is agnostic about how a server implements filtering strategies. In fact, the spec says:

Note: JSON API is agnostic about the strategies supported by a server. The filter query parameter can be used as the basis for any number of filtering strategies.

View JSON API Partial Success.md

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

It is possible for a server to have mixed success and error responses when dealing with a single or multiple entities at once. For instance, when generating collections of resource entities there is a chance that the GET operation results in a partial success. That is because each entity can generate errors independently from the other. In such scenarios the server MAY respond to the request with a partial success response.

Servers and clients MUST negotiate support for and use of the Partial Success extension as described in the base specification using partialsuccess as the name of the extension.

@e0ipso
e0ipso / JSONAPI Authenticated
Created Sep 16, 2016
JSONAPI and RESTful Web Services performance comparison
View JSONAPI Authenticated
====================================================================================================
AUTHENTICATED
====================================================================================================
>$ ab -v1 -k -c8 -n10 -A admin:admin http://d8dev.local/api/node/article/900b681b-581a-4624-9ff6-99cc865df429\?_format\=api_json\&include\=uid,uid.user_picture,field_tags
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking d8dev.local (be patient).....done
@e0ipso
e0ipso / environment-install.md
Last active Sep 12, 2016 — forked from alefi87/environment-install.md
OS X 10.10 Yosemite, Apache, PHP 5.6, MySQL, Memcache, SSL setup with Homebrew
View environment-install.md
View keybase.md

Keybase proof

I hereby claim:

  • I am e0ipso on github.
  • I am e0ipso (https://keybase.io/e0ipso) on keybase.
  • I have a public key whose fingerprint is 1AC6 C4F0 DE21 355A 8D1F FE1E 3ED2 1A07 EE8E 660B

To claim this, I am signing this object: