Skip to content

Instantly share code, notes, and snippets.

View marcw's full-sized avatar
👨‍🍳

Marc Weistroff marcw

👨‍🍳
View GitHub Profile
.svn
*.swp
*/.svn/*
lib/*/doctrine/base/*
lib/*/doctrine/*/base/*
web/*Plugin
cache/*
log/*
@marcw
marcw / export-database.sh
Created October 23, 2010 12:35
Automatically export a magento database and change all the base_url references
#!/bin/bash
# Export options
if [[ -z "$1" || -z $2 ]]
then
echo "export-database.sh"
echo " usage: ./export-database current_host distant_host"
echo " example: ./export-database my.local.host my.other.host"
exit 1;
fi
@marcw
marcw / gist:738082
Created December 12, 2010 14:42
vim settings for symfony2.
set tabstop=4
set shiftwidth=4
@marcw
marcw / site-directory.sh
Created December 25, 2010 19:31
List vhost available on your machine and render it as an HTML5 document
#!/bin/bash
# Config
DIR="/opt/local/apache2/conf/sites-enabled"
# View
TITLE="local vhosts"
H1="vhosts on $HOSTNAME"
HEADER="<!DOCTYPE html>\n<html><head><title>$TITLE</title></head><body><h1>$H1</h1><ul>\n"
@marcw
marcw / .gitconfig
Created February 22, 2011 18:05
git lint alias
[alias]
lint = "!sh -c 'git status | awk \"/modified/ {print \\$3} /new file/ {print \\$4}\" | xargs -L 1 php -l'"
<?php
class mA
{
const TEST = 'mA';
public function getSelf()
{
return self::TEST;
}
@marcw
marcw / .bash_aliases
Created March 30, 2011 15:12
how to create tag file
alias tags='ctags -f tags -h ".php" -R --exclude=".svn" --exclude="*.yml.php" --totals=yes --tag-relative=yes --PHP-kinds=+cf --fields=+afkst --regex-PHP="/@method[ ][^ ]+[ ]+([^ (]*)/\1/f/"'
@marcw
marcw / .vimrc
Created March 31, 2011 13:59
Insert the namespace in current php file
" Insert current namespace and opens php and create empty class, based on the file name
" last edited by https://www.github.com/ornicar
nmap <F9> ggO<?php<CR><CR><ESC>"%PdF/r;:s#/#\\#g<CR>Inamespace <ESC>d/[A-Z]<CR>Goclass <C-R>=expand("%:t:r")<CR><CR>{<CR>
@marcw
marcw / gist:909430
Created April 8, 2011 07:20
Add twig search to ack-grep
alias ack='ack-grep --type-set twig=.twig'
@marcw
marcw / gist:957148
Created May 5, 2011 14:35
Steal the namespace + class in a file.
noremap <C-F9> gg/^namespace /e<CR>l"nyt;f\"Ny /^class /e<CR>l"Nye<ESC>