This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
phpdbg -np* file.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
function panic_bootstrap_database($site_host = null, $incomming_host = null) { | |
$_SERVER['REMOTE_ADDR'] = $incomming_host ? $incomming_host : '127.0.0.1'; | |
$_SERVER['HTTP_HOST'] = $site_host ? $site_host : '127.0.0.1'; | |
$_SERVER['SCRIPT_NAME'] = '/index.php'; | |
define('DRUPAL_ROOT', __DIR__ . '/../html'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xdebug.remote_enable=on | |
xdebug.remote_host=192.168.57.1 | |
xdebug.remote_port=9000 | |
xdebug.profiler_enable_trigger=1 | |
xdebug.show_mem_delta=1 | |
xdebug.trace_enable_trigger=1 | |
xdebug.trace_format=1 | |
xdebug.collect_return=0 | |
xdebug.collect_params=0 | |
xdebug.collect_assignments=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MonVendor\MonBundle\Controller; | |
use MonVendor\MonBundle\Gestion\DemandeHelper; | |
use MonVendor\MonBundle\Gestion\Entity\Aide; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | |
use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseLink(uri) { | |
if (uri === "") { | |
return {}; | |
} | |
var pos = uri.indexOf('?'); | |
if (-1 !== pos) { | |
uri = uri.substr(pos + 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'https': | |
// Note: Only works when PHP is compiled with OpenSSL support. | |
$port = isset($uri['port']) ? $uri['port'] : 443; | |
$socket = 'ssl://' . $uri['host'] . ':' . $port; | |
$options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : ''); | |
if (empty($options['context'])) { | |
$options['context'] = stream_context_create(); | |
} | |
stream_context_set_option($options['context'], 'ssl', 'verify_host', false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired from (very far away) | |
# http://code-worrier.com/blog/git-branch-in-bash-prompt/ | |
# https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh | |
# | |
# I needed something simpler, and I work on slow FS so let it be minimal. | |
__git_br() { | |
local ingit="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
if (!isset($argv[1])) { | |
$host = '127.0.0.1'; | |
} else { | |
$host = $argv[1]; | |
} | |
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; | |
$_SERVER['HTTP_HOST'] = $host; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Drupal install speed. | |
*/ | |
/** | |
* Yes, this is important. | |
*/ | |
set_time_limit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mon_module/ | |
# ma_library/src/Toto.php <- namespace de ma library, par exmple Ma\Library\Toto | |
# mon_module.module | |
# Dans mon_module.module, genre en haut: | |
spl_autoload_register(function ($class) { | |
$parts = explode('\\', $class); | |
if ('Ma' === $parts[0] && 'Library' === $parts[1]) { |