Skip to content

Instantly share code, notes, and snippets.

View jbdelhommeau's full-sized avatar
🐙
Poulpe fiction

Jean-Baptiste Delhommeau jbdelhommeau

🐙
Poulpe fiction
View GitHub Profile
@jbdelhommeau
jbdelhommeau / robot.js
Created December 6, 2012 16:47
jeanbite
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
;Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5000
temp-night=3500
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature
transition=1
@jbdelhommeau
jbdelhommeau / tabModifier
Last active August 29, 2015 14:15
Tab modifier config
{
".insitu.sgm.mnesys.fr": {
"title": "[DEV] {title}",
"icon": "http://www.favicon.cc/favicon/414/753/favicon.png"
},
"pma.insitu.sgm.mnesys.fr": {
"title": "{title}",
"icon": "{default}"
}
}
@jbdelhommeau
jbdelhommeau / is_empty.php
Last active August 29, 2015 14:18
Recursive empty
$field1 = array(
array('field_14' => null, 'field_21' => array(array('field_22' => null, 'field_23' => null, 'field_24' => null)), 'field_19' => null, 'field_20' => null)
);
$field2 = array();
$field3 = array('field' => 'test');
$field4 = 'coucou';
private function getFieldDataValue(NoticeDataLang $fieldData)
{
if ($fieldData->getField()->getType() !== Field::TYPE_SET) {
return [$fieldData->getField()->__toForm() => $fieldData->getValue(false)];
}
if ($fieldData->getChildren()) {
$childData = [];
foreach ($fieldData->getChildren()->toArray() as $child) {
array_push($childData, [$child->getPart() => $this->getFieldDataValue($child)]);
this.context.treePath = [1,2,3];
EAD.prototype.treePath = function() {
var treePath = this.context.treePath;
_.forEach(this.context.path, function(n) {
if (treePath[n] === undefined) {
treePath[n] = {};
}
treePath = treePath[n];
}, this);
@jbdelhommeau
jbdelhommeau / tree.php
Last active August 29, 2015 14:22
Show files likes tree command
public function tree()
{
$nbFiles = iterator_count($this->getInnerIterator());
if ($this->io && $nbFiles > 0) {
$this->io->write('.');
$currentDir = array();
$depth = $countDir = 0;
foreach ($this->getInnerIterator() as $key => $file) {
$relativePath = $file->getRelativePath();
if (empty($relativePath)) {
@jbdelhommeau
jbdelhommeau / gitA2gitB.sh
Created June 23, 2016 12:54
Migrate existing respositories in hub A to Github.
#!/bin/bash
repos="my-repo1
my-repo2
my-repo3"
# Git A source can be github, gitlab
GIT_A='gitlab.com'
GIT_A_ORGANIZATION='miahou'
@jbdelhommeau
jbdelhommeau / watchers.xml
Last active September 16, 2019 09:34
Fix Php cs fixer with phpstorm Files > Settings > Tools > File Watchers > Import
<TaskOptions>
<TaskOptions>
<option name="arguments" value="fix --path-mode=intersection --using-cache=no $FilePathRelativeToProjectRoot$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="php" />
<option name="immediateSync" value="false" />
<option name="name" value="Php cs fixer" />
<option name="output" value="$FilePathRelativeToProjectRoot$" />
@jbdelhommeau
jbdelhommeau / CallMeBaby.php
Last active July 24, 2019 07:19
Phptorm mistake with __invoke function autocomplete and click to go
<?php
namespace App;
use App\InvokeMe;
use App\Dependency2;
class CallMeBaby
{
private $dep2;