Skip to content

Instantly share code, notes, and snippets.

@moux2003
moux2003 / .gitconfig
Last active May 4, 2021 07:52
git config file
[alias]
# Checkout
co = checkout
# Clean sync remote/local branches
cl = "! git fetch -p && for branch in $(git branch -vv | grep ': disparue]' | awk '{print $1}'); do git branch -D $branch; done"
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
#
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(cyan)%d %Creset%s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative
#
@moux2003
moux2003 / filename.html.twig
Created October 14, 2013 15:22
Acces twig context variables
{% for key, value in _context %}
<li>{{ key }}</li>
{% endfor %}
@moux2003
moux2003 / permissions.sh
Created September 3, 2013 16:07
Set permissions
#!/bin/sh
if [ -d app/cache ]; then rm -rf app/cache/*; fi
if [ -d app/logs ]; then rm -rf app/logs/*; fi
if [ -d app/spool ]; then rm -rf app/spool/*; fi
# source : https://raw.github.com/everzet/dotfiles/master/scripts/chcache
USER=$(whoami)
APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}')
@moux2003
moux2003 / array.js
Created September 3, 2013 16:05
Is value in array
// true if needed is found in list
function ( list, needed ) { return !!~list.indexOf( needed ); }
@moux2003
moux2003 / Entity.php
Created July 16, 2013 08:13
Validate user age
use FOS\UserBundle\Model\User as ModelUser;
use Virgin\UserBundle\Validator\Constraints as VirginAssert;
/**
* Storage agnostic user object
*
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class User extends ModelUser