Skip to content

Instantly share code, notes, and snippets.

View arnaud-lb's full-sized avatar

Arnaud Le Blanc arnaud-lb

View GitHub Profile
" 'apprentice_blue.vim' -- Vim color scheme.
" Author: Arnaud Le Blanc
" Description: Based on the 'apprentice' color scheme
" MADE-UP NAME HEX RGB XTERM ANSI
" ========================================================================
" almost black #1c1c1c rgb(28, 28, 28) 234 0
" darker grey #262626 rgb(38, 38, 38) 235 background color
" dark grey #303030 rgb(48, 48, 48) 236 8
" grey #444444 rgb(68, 68, 68) 238 8
<?php
namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`};
class ${2:`Filename('', 'myClass')`}
{
${3}
}
" ftplugin/php.vim
if !exists("*s:JumpToTest")
function s:isTestFile()
return expand("%s") =~ "/Tests/.*Test.php$"
endfunction
function s:testFile()
if s:isTestFile()
return expand("%")
@arnaud-lb
arnaud-lb / ClearListener.php
Last active December 16, 2015 21:39
Clear DoctrineExtensions entity wrapper cache when clearing entity manager
<?php
use Doctrine\ORM\Event\OnClearEventArgs;
use Gedmo\Tool\Wrapper\AbstractWrapper;
/**
* Register the listener with $em->getEventManager()->addEventListener('onClear', new ClearListener())
*/
class ClearListener
{
Assign $a *1(!2(1)) NULL dim:NULL property:NULL
Assign $b *4(!5(2)) NULL dim:NULL property:NULL
Add $a $b *8(!9)
PrintOp *8(!9) NULL *10(!11)
ReturnOp NULL NULL NULL
@arnaud-lb
arnaud-lb / pre-commit.sh
Created December 1, 2012 11:58 — forked from yangsu/pre-commit.sh
pre-commit git hook for crushing images
#!/bin/sh
# to use, save this file as .git/hooks/pre-commit in your git repo
# make sure to add execute permissions using: chmod +x .git/hooks/pre-commit
command -v pngcrush >/dev/null 2>&1 || {
echo "\033[1mPlease install pngcrush to reduce images size before commit\033[0m"
echo "Install pngcrush with the following:"
echo "\t \033[1mbrew install pngcrush\033[0m"
echo "OR"
echo "\t Site: \033[1m\033[4mhttp://pmt.sourceforge.net/pngcrush/\033[0m"
echo "\t Download: \033[1m\033[4mhttp://sourceforge.net/projects/pmt/files/\033[0m"
@arnaud-lb
arnaud-lb / twig-repl.php
Created September 19, 2012 21:10
Twig REPL
<?php
/**
* Twig REPL hack
*
* Arnaud Le Blanc <[email protected]>
*/
require 'lib/Twig/Autoloader.php';
Twig_Autoloader::register();
@arnaud-lb
arnaud-lb / flush.php
Created September 15, 2012 10:14
flush email queue from symfony command
<?php
protected function flushQueue()
{
$container = $this->getContainer();
$transport = $container->get('mailer')->getTransport();
$spool = $transport->getSpool();
$spool->flushQueue($container->get('swiftmailer.transport.real'));
@arnaud-lb
arnaud-lb / attrs.haml
Created August 25, 2012 19:32
MtHaml attributes example
/ --------------------------------------------------
/ when value is false (or null), attr isn't rendered
/ --------------------------------------------------
%input(type="checkbox" checked=false)
%div(class=(false ? false : "test"))
/ <input type="checkbox" />
/ <div></div>
@arnaud-lb
arnaud-lb / html2haml.py
Created July 13, 2012 17:15
html2haml code style fixed
#!/usr/bin/env python
import subprocess
import re
orig = subprocess.check_output(["/usr/local/bin/html2haml"])
result = orig
result = re.sub(r' ', ' ', result)