Skip to content

Instantly share code, notes, and snippets.

View michaellopez's full-sized avatar

Michael Zetterberg fd. Lopez michaellopez

View GitHub Profile
@michaellopez
michaellopez / svgo-config-svgr.json
Last active September 28, 2018 11:00
SVGO config for SVGR
{
"plugins": [
{
"removeDoctype": true
},
{
"removeXMLProcInst": true
},
{
"removeComments": true
@michaellopez
michaellopez / viewsreference_add_entity_to_context-2.patch
Last active April 12, 2018 21:43 — forked from filiphazardous/viewsreference_add_entity_to_context-2.patch
Add nodes in block to context for viewsreference v2
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();
@michaellopez
michaellopez / keybase.md
Created February 3, 2017 08:40
Keybase proof

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 November 26, 2015 11:52
Rancher crash exception
[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
terminal = require('color-terminal')
log = (error, stdout, stderr, cb) ->
if error
terminal.color('red').write stdout
else
terminal.color('green').write stdout
cb()
@michaellopez
michaellopez / 1 — readme.md
Created May 2, 2014 09:29 — forked from jjb/1 — readme.md
Leave closed Trello
  1. go here and get your Developer Key (ignore that token) https://trello.com/1/appKey/
  2. visit this url, with your Developer Key inserted as shown https://trello.com/1/authorize?key=YOURDEVELOPERKEY&name=My+Application&expiration=1day&response_type=token&scope=read,write
  3. grant access, and then get the token that is produced on the next page
  • You'll need to add a file in the same directory called settings.py that contains strings for MY_KEY, MY_TOKEN, and USER_TOKEN (USER_TOKEN can be an empty string)
  • Run the script with the last line commented out to see what boards you're leaving. When you're ready to do it for real, uncomment the last line.
@michaellopez
michaellopez / fluidapp-gmail.js
Last active August 29, 2015 13:58
Fluidapp Gmail badge + notifications
/**
* Description: Updates the badge to the unread count.
* Scrapes the inbox for new mail every 5 seconds and displays a notification for each new message.
* Does not support new messages in a conversation. I.e. 1 row in the inbox = 1 notification.
* Only tested on OS X Mountain Lion. This will break when Gmail changes their DOM!
*
* Patterns:
* *gmail.com*
* *mail.google.com*
* *google.com*mail*
@michaellopez
michaellopez / Gruntfile.js
Last active January 2, 2016 23:08
Handle scientific e notation hash in Grunt
if (grunt.config.get('config.changeSet') === Infinity) {
grunt.log.writeln('ChangeSet was interpreted as Infinity. Trying to manually parse command line arguments.'.yellow);
grunt.log.writeln('A single "e" in the changeset is interpreted with scientific notation, sometimes causing "Infinity".'.yellow);
process.argv.forEach(function(val) {
if (val.indexOf('hgid') >= 0) {
var changeSet = val.split('=');
if (changeSet[1]) {
grunt.config.set('config.changeSet', changeSet[1]);
return false; // Break loop
@michaellopez
michaellopez / brew-update-fail-config
Created November 14, 2013 12:00
Output for brew issue 24290
$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 36ba8e6805c9d5a00dc4c33d28b5c2728dc673db
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit arrandale
OS X: 10.8.5-x86_64
CLT: 5.0.1.0.1.1377666378
GCC-4.2: build 5666
@michaellopez
michaellopez / trello-color-card-fluid.user.js
Last active December 25, 2015 05:29
Trello Color Card for Fluid
// ==UserScript==
// @name Trello Color Card
// @namespace http://weahead.se
// @author Michael Lopez <michael@weahead.se>
// @description Colors Trello cards depending on completed checklist items.
// @include https://trello.com/*
// ==/UserScript==
(function () {
if (window.fluid) {