Skip to content

Instantly share code, notes, and snippets.

View lsoudade's full-sized avatar

Lorraine Soudade lsoudade

View GitHub Profile
<?php
$to = 'contact@monsite.com';
$subject = 'Bonjour à tous';
$subject = '=?UTF-8?B?'.base64_encode($subject).'?=';
$content = 'Contenu du mail à problème';
$headers = 'Content-Type: text/plain; charset=utf-8'."\r\n";
mail($to, $subject, $content, $headers);
?>
<?php
$to = 'contact@monsite.com';
$subject = 'Bonjour à tous';
$content = 'Contenu du mail à problème';
mail($to, $subject, $content);
?>
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/
"
}
export PS1='\u@\h \w$(parse_git_branch)$ '
(function($) {
// définition du plugin jQuery
$.fn.backgroundColor = function(color) {
// Traverser tous les nœuds.
this.each(function() {
$(this).css('background', color);
});
// Permettre le chaînage par jQuery
return this;
$('#parent').on('click', function(e) {
if( e.target !== this ) {
return;
}
});
<div id="fb-root"></div>
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : {{ appId }},
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
<?php
$form->get('field')->addError(new Symfony\Component\Form\FormError\FormError('message erreur'));
?>
<?php
$id = 123;
$entity = new Entity();
$entity->setId($id);
$this->em->persist($entity);
// Forçons la valeur de l'id
$metadata = $this->em->getClassMetaData(get_class($entity));
SELECT COUNT(*) FROM commentaires WHERE user_id = 1 LIMIT 0,20;
SELECT COUNT(*) FROM ( SELECT * FROM commentaires WHERE user_id = 1 LIMIT 0,20 ) commentaires;