Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Zetterberg fd. Lopez michaellopez

View GitHub Profile
@michaellopez
michaellopez / output.sh
Created Oct 25, 2019
now: yarn test error
View output.sh
$ yarn test
yarn run v1.19.1
error Command "test" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@michaellopez
michaellopez / output.sh
Last active Oct 25, 2019
now: yarn lint errors
View output.sh
$ yarn lint
yarn run v1.19.1
$ eslint . --ext .ts,.js
.../now/packages/now-build-utils/src/debug.ts
1:63 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
.../now/packages/now-build-utils/src/fs/glob.ts
48:30 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion
49:23 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion
@michaellopez
michaellopez / readme.md
Created Apr 26, 2019 — forked from astoilkov/readme.md
Async Operations with useReducer Hook
View readme.md

Async Operations with useReducer Hook

We were discussing with @erusev what we can do with async operation when using useReducer() in our application. Our app is simple and we don't want to use a state management library. All our requirements are satisfied with using one root useReducer(). The problem we are facing and don't know how to solve is async operations.

In a discussion with Dan Abramov he recommends Solution 3 but points out that things are fresh with hooks and there could be better ways of handling the problem.

Problem

Doing asynchronous operations in a useReducer reducer is not possible. We have thought of three possible solutions and can't figure which one is better or if there is an even better solution.

@michaellopez
michaellopez / sparkpost-return_path.patch
Created Jan 22, 2019
Patch that adds return_path / envelope FROM to Sparkpost Drupal module
View sparkpost-return_path.patch
diff --git a/config/install/sparkpost.settings.yml b/config/install/sparkpost.settings.yml
index e014059..504215a 100644
--- a/config/install/sparkpost.settings.yml
+++ b/config/install/sparkpost.settings.yml
@@ -2,6 +2,7 @@ api_key:
debug: true
sender:
sender_name:
+return_path:
format: ''
View field_collection-2936874-php72-11.patch
diff --git a/field_collection.entity.inc b/field_collection.entity.inc
index 2e8a11b..ed8dfb7 100644
--- a/field_collection.entity.inc
+++ b/field_collection.entity.inc
@@ -291,24 +291,29 @@ class FieldCollectionItemEntity extends Entity {
protected function fetchHostDetails() {
if (!isset($this->hostEntityId)) {
if ($this->item_id) {
+ $in_use = $this->isInUse();
+
View composer-patches-1.6.5-call-the-preserve-paths-hooks.patch
diff --git a/src/Patches.php b/src/Patches.php
index 70c5b83..ba01d6d 100644
--- a/src/Patches.php
+++ b/src/Patches.php
@@ -8,10 +8,14 @@
namespace cweagans\Composer;
use Composer\Composer;
+use Composer\DependencyResolver\DefaultPolicy;
+use Composer\DependencyResolver\Pool;
View svgo-config-svgr.json
{
"plugins": [
{
"removeDoctype": true
},
{
"removeXMLProcInst": true
},
{
"removeComments": true
View viewsreference_add_entity_to_context-2.patch
diff --git a/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php b/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php
index 7371caf..36252cf 100644
--- a/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php
@@ -100,6 +100,9 @@ class ViewsReferenceFieldFormatter extends FormatterBase {
}
$node = \Drupal::routeMatch()->getParameter('node');
+ if ($items->getEntity() instanceof \Drupal\node\NodeInterface) {
+ $node = $items->getEntity();
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@michaellopez
michaellopez / var-log-messages
Created Nov 26, 2015
Rancher crash exception
View var-log-messages
[rancher@rancher-server ~]$ cat /var/log/messages
...
Nov 24 13:17:06 rancher sshd[3573]: Disconnected from 172.20.0.11
Nov 24 20:48:20 rancher kernel: [47826.765444] docker invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Nov 24 20:48:20 rancher kernel: [47826.766858] docker cpuset=/ mems_allowed=0
Nov 24 20:48:20 rancher kernel: [47826.767548] CPU: 1 PID: 390 Comm: docker Not tainted 4.2.3-rancher #1
Nov 24 20:48:20 rancher kernel: [47826.768488] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
Nov 24 20:48:20 rancher kernel: [47826.769855] 0000000000000000 0000000000000000 ffffffff8159e913 ffff88002fdd0000
Nov 24 20:48:20 rancher kernel: [47826.771827] ffffffff8159bd05 0000000000000016 ffffffff81086352 ffffffff81a12808
Nov 24 20:48:20 rancher kernel: [47826.773281] 0000000000000016 0000000000000000 000000000003e469 0000000000000000
You can’t perform that action at this time.