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/sh | |
# Thank you so much, mab! | |
cd $HOME | |
wget https://nodejs.org/dist/v4.1.1/node-v4.1.1-linux-x64.tar.gz | |
tar xzf node-v4.1.1-linux-x64.tar.gz | |
rm -rf node-v4.1.1-linux-x64.tar.gz | |
mv node-v4.1.1-linux-x64 node | |
export PATH="$PATH:$HOME/node/bin" | |
npm install gulp | |
export PATH="$PATH:$HOME/node_modules/.bin" |
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
/*jslint browser: true, plusplus: true, todo: true, white: true */ | |
/*globals Drupal, jQuery */ | |
// Simple placeholder fix for IE8, not a polyfill: | |
// If a field has no label displayed: | |
// - If the label is hidden (sr-only or element-invisible) then just show it. | |
// - If there is no label but a placeholder, build a label using the | |
// placeholder value. | |
(function(jQuery) { | |
"use strict"; |
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
/** | |
* This function is reentrant. | |
*/ | |
function mymodule_install_schema_fix() { | |
$constraints = [ | |
'lo_register_phone' => [ | |
'fk_lo_register_phone_user' => "ALTER TABLE {lo_register_phone} ADD CONSTRAINT {fk_lo_register_phone_user} FOREIGN KEY (uid) REFERENCES {users} (uid) ON DELETE CASCADE", | |
], | |
]; |
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]) { |
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
#!/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
#!/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
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
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
<?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; |