Skip to content

Instantly share code, notes, and snippets.

@Stunc0
Stunc0 / removeElementFromArrayByAttribute.js
Created August 23, 2017 15:39
[Remove element from array] Remove element from array by attribute #js #array #object #element
$.each(monTableau, function(i){
if(monTableau[i].unAttribut == ceQueJeCherche) {
monTableau.splice(i,1);
return false;
}
});
@Stunc0
Stunc0 / partenaires-conducteurs.php
Created July 13, 2017 15:33
[Partenaires] Snippet appli Partenaires Conducteurs #PHP #Symfony #driver #contract #mission
//check que le driver est bien le driver associé au contrat
$this->getUser() != $this->get('partenaire_conducteur_service_propose_mission_service')->getMissionDriver($mission)
@Stunc0
Stunc0 / console.php
Last active July 13, 2017 15:30
[Console] #Console #PHP #alias
// Changement du pointeur (alias) de commande PHP pour rediriger vers le PHP de MAMP
alias php="/Applications/MAMP/bin/php/php7.0.15/bin/php"
@Stunc0
Stunc0 / symfony-user.php
Created June 29, 2017 16:06
[Symfony user] #Symfony #user
$this->getUser()
@Stunc0
Stunc0 / symfony-docrtine.php
Last active June 29, 2017 12:39
[Symfony Doctrine] #symfony #entity #doctrine #findAll #find
//find all object from ObjectClass
$this->getDoctrine()->getRepository(ObjectClass::getClass())->findAll()
//save object
$this->getDoctrine()->getManager()->flush($object);
@Stunc0
Stunc0 / yii-cache.php
Last active June 27, 2017 07:43
[Yii Cache] #Yii #cache
Yii::$app->cache;
Yii::$app->cache->get($key);
Yii::$app->cache->set($key, $object, $time);
Yii::$app->cache->getOrSet($key, function() use() {
return $something;
}, $time);
@Stunc0
Stunc0 / yii-user.php
Created June 26, 2017 21:45
[Yii User] #Yii #user
Yii::$app->user;