Skip to content

Instantly share code, notes, and snippets.

@huyby
huyby / skip_includes_fieldresolver.patch
Created November 8, 2017 16:15
Temp 'fix' to allow related resource endpoints keep using nested include resources (e.g. field_image,field_image.uid)
diff --git a/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php b/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
index e74b26a..1e4bb69 100644
--- a/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
+++ b/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
@@ -247,6 +247,8 @@ class JsonApiDocumentTopLevelNormalizer extends NormalizerBase implements Denorm
protected function expandContext(Request $request, ResourceType $resource_type) {
// Translate ALL the includes from the public field names to the internal.
$includes = array_filter(explode(',', $request->query->get('include')));
+ $public_includes = $includes;
+ /*

Keybase proof

I hereby claim:

  • I am huyby on github.
  • I am huyby (https://keybase.io/huyby) on keybase.
  • I have a public key ASC7CON4vlaKiFbFqvQ1K6e2hYC5g_5yl5VDf5VTose69wo

To claim this, I am signing this object:

@huyby
huyby / github-unsubscribe-all.js
Last active June 5, 2024 12:32
Github subscription clean up
function unsubscribeAll() {
fetch('https://github.com/notifications/subscriptions?reason=review_requested', {
method: 'POST',
body:new FormData(document.querySelector('#threads-unsubscribe-form')),
})
.then((response) => response.text())
.then((text) => {
document.querySelector('html').innerHTML=text
const subscriptionIds = document.querySelectorAll('input[name^=subscription_ids]');