Skip to content

Instantly share code, notes, and snippets.

@chelmertz
chelmertz / sv.csv
Created July 16, 2010 13:06
Embryo of Swedish translation of Pimcore
forms Formulär
add_form_component Lägg till formulärdel
save_only_scheduled_tasks Spara endast schemaläggningar
minify_javascript_algorithm Javascript minification algorithm
modified_assets Ändrade Assets
modification_statistic Förändringar under de senaste 31 dagarna
minify_javascript Minify Javascript
minify_css Minify CSS
content Innehåll
slider_settings Slider Settings
@chelmertz
chelmertz / Number of php global functions.php
Created October 4, 2010 15:40
number of global php functions
<?php
$c = new Zend_Http_Client('http://php.net/quickref.php');
echo substr_count($c->request()->getBody(), 'function.'); // 5468 today, 4th of October 2010
@chelmertz
chelmertz / useful commands.vim
Created October 9, 2010 19:50
vim shortcuts
"search for "bla":
/bla
"replace "bla" with "blue" throughout file:
:%s/bla/blue/g
"replace "bla" with "blue" throughout visual selection:
:'<,'>s/bla/blue/g
"go to line 51
# Prerequisites: git installed, account at github.com
# This demo is performed at a mac
git clone https://github.com/mattn/gist-vim.git ~/ # get the gist plugin for vim
cp ~/gist-vim/plugin/gist.vim ~/.vim/plugin/ # place the plugin where it belongs
git config --global github.user <user> # replace <user> with your github username
git config --global github.token <token> # replace <token> with token found in github > account settings > account admin
# try it out
@chelmertz
chelmertz / pre-commit
Created February 8, 2011 09:25
pre-commit hook for git, running php lint
#!/usr/bin/php
<?php
// copied from http://phpadvent.org/2008/dont-commit-that-error-by-travis-swicegood
// authored by Travis Swicegood
$output = array();
$return = 0;
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
$against = $return == 0 ? 'HEAD' : '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
@chelmertz
chelmertz / acronym_demo.php
Created February 15, 2011 20:56
Hz_Filter_Acronym
<?php
$words = array(
'omg' => 'Oh my god',
'BRB' => 'Be right back'
);
require 'Hz/Filter/Acronym.php';
$filter = new Hz_Filter_Acronym($words);
@chelmertz
chelmertz / tail.sh
Created March 15, 2011 09:54
tail php
alias tail_php="clear;date;tail -f /var/log/apache2/error.log -n 0"
@chelmertz
chelmertz / common_commands.sh
Created April 19, 2011 08:51
git & bash - common commands
grep -l match_against in_files # -l only lists filenames
ls -1 # filenames STDIN ready
ls -x # space separated filenames
git show HEAD~1:index.html # what did I just commit?
git checkout HEAD~1 index.html # regret one file of a commit, not a complete rollback
@chelmertz
chelmertz / colored_git_branch_prompt.sh
Created April 29, 2011 18:17
show current branch in bash prompt
#from http://www.jonmaddox.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
@chelmertz
chelmertz / iterm2.md
Created July 8, 2011 19:11
iterm2 cheatsheet

#split window horizontally ⌘ + d