Skip to content

Instantly share code, notes, and snippets.

View komlenic's full-sized avatar

Chris Komlenic komlenic

View GitHub Profile
# Automatically format/wrap text
:set tw=79
:set formatoptions+=t
# ...select text...
gq
@komlenic
komlenic / vim_phpcs_drupal_syntastic.txt
Last active December 23, 2017 08:35
Installing drupal code standards in vim + syntastic
# This assumes you already have installed vim, and syntastic (and of course php).
# Download the Drupal coder module. You could do this via other methods but git is nice.
# You can place this wherever, but take note of where you placed it. Something like
# /usr/local/src might be good.
git clone --branch 8.x-2.x http://git.drupal.org/project/coder.git
# Install php code sniffer (phpcs). Using pear.
pear install PHP_CodeSniffer
@komlenic
komlenic / DOMElement.innerHTML.php
Created November 17, 2011 18:54
Get innerHTML of a php DOMElement
<?php
// See http://www.php.net/manual/en/class.domelement.php#101243
function get_inner_html( $node ) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;