Skip to content

Instantly share code, notes, and snippets.

alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
[push]
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
 
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
GRAY="\[\033[1;30m\]"
LIGHT_GRAY="\[\033[0;37m\]"
CYAN="\[\033[0;36m\]"
/**
* @Route("/users/delete/{id}", requirements={"id" = "\d+"}, defaults={"id" = 0})
* @Template()
*/
public function deleteAction($id)
{
if ($id == 0){ // no user id entered
return $this->redirect($this->generateUrl('users_list_users_index'), 301);
}
<form action="{{path('users_list_users_add')}}" method="post" {{ form_enctype(form) }}>
{{form_widget(form)}}
<input type="submit" />
</form>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.name }}</td>
<td>{{ user.email }}</td>
<td>{{ user.phone }}</td>
<td><a href="users/edit/{{ user.id }}">Edit</a></td>
<td><a href="users/delete/{{ user.id }}">Delete</a></td>
</tr>
{% endfor %}
/**
* @Route("/users")
* @Template()
*/
public function indexAction()
{
$repository = $this->getDoctrine()
->getRepository('UsersListBundle:Users');
$users = $repository->findAll();
@charset "utf-8";
/* CSS Document */
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
<?php
// src/Users/Bundle/ListBundle/Entity/Users.php
namespace Users\Bundle\ListBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="users")
<?php
namespace Users\Bundle\ListBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class UsersController extends Controller
{