Skip to content

Instantly share code, notes, and snippets.

View bdelespierre's full-sized avatar
🚩
Working from home

Benjamin Delespierre bdelespierre

🚩
Working from home
View GitHub Profile

Auteur original: Christine Morlet, CSP
Traduit de l'anglais par: Benjamin Delespierre
Article original: 6 conseils pour une communication assertive

Qu'est ce que la communication assertive ?

La communication assertive est la capacité d'exprimer des idées et des sentiments tant négatifs que positifs de façon ouverte, honnête et directe. Elle reconnait nos droits tout en respectant les droits des autres.

Elle nous permet de nous responsabiliser nous-même ainsi que nos actions sans juger ou blamer d'autres personnes. Et elle nous permet de nous confronter constructivement et de trouver une solution mutuellement satisfaisante là ou les les conflits existent.

@bdelespierre
bdelespierre / gist:5533867
Last active February 3, 2017 09:49
A very simple PHP chat on 1 instruction (no loop, no closure, no control structure)
<?php ($_='[["accueil","messages","contact","vider"],["Menu","Votre message","d/m/Y H:i:s","message","Envoyer","Me Contacter","benjamin.delespierre@gmail.com","chat.log","Fichier supprim&eacute;","Messages"]]') &&($_GET+=['p'=>null]) &&in_array($p = $_GET['p'], (($j=json_decode($_,true))&&($s=$j[0])&&($w=$j[1])) ? $s : array()) ?($s[0]==$p &&array_shift($s) &&print('<h1>'.$w[0].'</h1><ul><li>'.implode('</li><li>',array_map('sprintf',array_fill(0, count($s), '<a href="?p=%s">%s</a>'),$s,$s))))||($r=sprintf('<a href="?p=%s">%s</a>',$s[0],$s[0])) &&(($s[1]==$p &&vprintf('<h1>%s</h1>%s<hr/>%s<hr/>'.$r,array($w[3],sprintf('<form action="?p=%s" method="post"><input name="n" placeholder="%s"><button type="submit">%s</button></form>',$p,$w[1],$w[4]),((isset($_POST['n']) &&($h = fopen($w[7],'a+')) &&fwrite($h, date($w[2]).": {$_POST['n']}\n")) ? '' : '').'<p>'. implode('</p><p>',is_file($w[7]) ? array_reverse(file($w[7])) : array()). '</p>')))||($s[2]==$p &&printf('<p><a href="mailto:%s">%s</a></p>'.$r,$w[6],$w[5]))||

https://www.toptal.com/javascript/interview-questions


Q: Quel est le piège potentiel d'utiliser typeof bar === "object" pour déterminer si bar est un objet ? Comment ce piège peut être évité ?

A: En JavaScript tout est objet y compris NULL ce qui peut poser problème si on teste de cette façon. Pour contourner le problème on peut faire

(bar !== null) && (typeof bar === "object") && (toString.call(bar) !== "[object Array]")
@bdelespierre
bdelespierre / PHP New Features CheatSheet.md
Last active July 5, 2017 14:26
A brief history of PHP features

PHP New Features CheatSheet

The neatest PHP cheatsheet around. Trust me, I'm a random Gist from GitHub :octocat:

@bdelespierre
bdelespierre / hatchshow.js
Last active August 4, 2017 19:47 — forked from charliepark/hatchshow.js
A jquery typography plugin.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
$('.hsjs').hatchShow();
});
(function($){
jQuery.fn.hatchShow = function(){
return $(this).css({
display: 'inline-block',
<?php
namespace Addworking\JobOffers;
class LaravelDeveloper extends JobOffer
{
use Concerns\IsAwesome, Concerns\IsStartup, Concerns\IsDisruptive;
protected $fillable = [
'firstname', 'lastname', 'email',
@bdelespierre
bdelespierre / array_cartesian_product.php
Created February 8, 2018 13:22
Array cartesian product
<?php
function array_cartesian_product(...$items): array
{
if (empty($items)) {
return [];
}
if (count($items) == 1) {
foreach ((array) $items[0] as $value) {
@bdelespierre
bdelespierre / gist:5876883
Created June 27, 2013 14:29
X11 colors names in JSON
[
{
"name": "Pink",
"hex": "ffc0cb",
"rgb": "255,192,203"
},
{
"name": "LightPink",
"hex": "ffb6c1",
"rgb": "255,182,193"
<?php
// ----------------------------------------------------------------------------
// $argc: nombre d'argument de la commande
// ----------------------------------------------------------------------------
// e.g. pour la commande 'php file.php foo bar baz',
// $argc vaut 3
// car il y a 3 arguments: "foo", "bar", et "baz"
var_dump($argc);
<?php
include __DIR__ . '/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance