Skip to content

Instantly share code, notes, and snippets.

View chartjes's full-sized avatar

Chris Hartjes chartjes

View GitHub Profile
vagrant@localhost ~]$ sudo yum install gearmand -y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.mirror.netelligent.ca
* extras: centos.mirror.netelligent.ca
* updates: centos.westmancom.com
No package gearmand available.
Error: Nothing to do
[vagrant@localhost ~]$ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
"
" MAIN CUSTOMIZATION FILE
"
set nocompatible
filetype off
call pathogen#infect()
syntax on
filetype plugin indent on
// XML ruleset
<?xml version="1.0"?>
<ruleset name="Namespacing Check"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
class NamespaceChecker extends AbstractRule implements MethodAware
{
public function apply(\PHPMD\AbstractNode $node)
{
$whitelist = array('self', 'parent', 'static');
foreach ($node->findChildrenOfType('ClassOrInterfaceReference') as $child) {
if (!in_array($child->getName(), $whitelist)) {
try {
$reflector = new ReflectionClass($child->getName());
} catch (Exception $e) {
<?php
require 'vendor/autoload.php';
use PHPMD\AbstractNode;
use PHPMD\AbstractRule;
use PHPMD\Rule\MethodAware;
class NamespaceChecker extends AbstractRule implements MethodAware
{
public function apply(\PHPMD\AbstractNode $node)
"
" MAIN CUSTOMIZATION FILE
"
set nocompatible
filetype off
call pathogen#infect()
Helptags
syntax on
filetype plugin indent on
I use these bundles plus Pathogen
~/.vim/bundle ᐅ ls -l
total 0
drwxr-xr-x@ 6 chartjes staff 204 8 Dec 14:06 Greplace.vim
drwxr-xr-x@ 9 chartjes staff 306 9 Dec 13:05 ack.vim
drwxr-xr-x@ 5 chartjes staff 170 1 May 2013 closetag.vim
drwxr-xr-x@ 8 chartjes staff 272 8 Dec 14:07 ctrlp.vim
"
" MAIN CUSTOMIZATION FILE
"
set nocompatible
filetype off
call pathogen#infect()
Helptags
syntax on
filetype plugin indent on
@chartjes
chartjes / gist:0ceab3f2bc282eb192f4
Created January 22, 2015 20:56
Find files with Syntax errors
find . -iname "*.php" -exec php -l {} \; | grep -i "Errors.parsing"
BUT
I only want to get something like
./foo/bar/biz.php
as the output
@chartjes
chartjes / gist:c740fdd9a99f49962707
Last active August 29, 2015 14:11
Unflattening arrays in PHP
$router->addRoute('sending-drip-campaigns', new \Zend_Controller_Router_Route('sending/drip-campaigns/:action/*', array('module' => 'sending' , 'controller' => 'drip-campaigns','action' => 'index')));
// turn into
$router->addRoute(
'sending-drip-campaigns',
new \Zend_Controller_Router_Route(
'sending/drip-campaigns/:action/*',
array(
'module' => 'sending',
'controller' -> 'drip-campaigns',