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 / 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) {
@michaellopez
michaellopez / unziptest.js
Created March 27, 2013 08:38
node-unzip event testcase
var unzip = require('unzip');
var path = 'output';
var file = 'file.zip';
var unzipStream = unzip.Extract({ path: path });
unzipStream.on('finish', function () { console.log('Zipstream Finish') });
unzipStream.on('data', function () { console.log('Zipstream Data') });
unzipStream.on('error', function () { console.log('Zipstream Error') });
unzipStream.on('close', function () { console.log('Zipstream Close') });
unzipStream.on('end', function () { console.log('Zipstream End') });
@michaellopez
michaellopez / squashpr.sh
Last active December 14, 2015 09:18
Squash Github pull request to 1 commit
// Revised from http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request
git fetch upstream
git checkout <branch name>
git rebase upstream/master -i
# choose squash for all of your commits, except the first one
# Edit the commit message to make sense, and describe all your changes
git push origin <branch name> -f
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
# Usage: checkpoint.sh load|unload
# You will need sudo power, of course
#
if [ $1 == "unload" ]
@michaellopez
michaellopez / HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install foo
Last active December 11, 2015 07:18
Subversion does not run after SQLite was converted to keg_only (10.6.8)
$ brew rm sqlite svn
Uninstalling /usr/local/Cellar/sqlite/3.7.15.1...
Uninstalling /usr/local/Cellar/subversion/1.7.8...
$ HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install svn
==> Installing subversion dependency: sqlite
==> Downloading http://sqlite.org/sqlite-autoconf-3071501.tar.gz
Already downloaded: /Users/michael/Library/Caches/Homebrew/sqlite-3.7.15.1.tar.gz
/usr/bin/tar xf /Users/michael/Library/Caches/Homebrew/sqlite-3.7.15.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/sqlite/3.7.15.1 --disable-dependency-tracking --enable-dynamic-extensions
./configure --prefix=/usr/local/Cellar/sqlite/3.7.15.1 --disable-dependency-tracking --enable-dynamic-extensions