This file contains hidden or 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
n=$RANDOM | |
# display random number between 1 and xxx. | |
echo $((RANDOM%146+1)) | |
echo $((RANDOM%146+1)) |
This file contains hidden or 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 | |
function publiviews_js_alter(&$js) { | |
$js['settings']['data'][] = array( | |
'better_exposed_filters' => array( | |
'datepicker_options' => array( | |
'dateformat' => 'dd-mm-yy', | |
))); | |
} | |
?> |
This file contains hidden or 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 | |
function mymodule_views_data_alter(&$data) { | |
$data['node']['created'] = array( | |
'title' => t('Post date'), // The item it appears as on the UI, | |
'help' => t('The date the content was posted.'), // The help that appears on the UI, | |
'field' => array( | |
'handler' => 'views_handler_field_date', | |
'click sortable' => TRUE, | |
), | |
'sort' => array( |
This file contains hidden or 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
; Unix user/group of processes | |
; Note: The user is mandatory. If the group is not set, the default user's group | |
; will be used. | |
user = www-data | |
group = www-data | |
; The address on which to accept FastCGI requests. | |
; Valid syntaxes are: | |
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on | |
; a specific port; |
This file contains hidden or 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
Installing Xdebug | |
1. Install Xdebug for php | |
sudo apt-get install php5-xdebug | |
2. Setup xdebug.ini for ubuntu | |
vim /etc/php5/fpm/conf.d/20-xdebug.ini |
This file contains hidden or 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
See: https://www.drupal.org/node/1420008 | |
To integrate Drupal Code Sniffer into Netbeans you need the following: | |
PHP CodeSniffer Netbeans Plugin | |
Run pear config-get php_dir to know the path to your PEAR folder | |
Put the folder with the PHP_CodeSniffer coding standard inside PEAR/pear/PHP/CodeSniffer/Standards folder | |
Edit PEAR/pear/PHP/CodeSniffer.php and add the extensions to $allowedFileExtensions | |
this can look like : | |
array( |
This file contains hidden or 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 | |
// @see: https://www.drupal.org/node/150215 | |
/** | |
* Add new fields to 'mytable' table. | |
*/ | |
function MYMODULE_update_7001() { | |
$fields = array( | |
'field_name_1' => array( | |
'description' => 'Field name 1', |
This file contains hidden or 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
git config --global alias.lg 'log --all --graph --decorate --oneline' | |
### OR ### | |
[alias] | |
lg = log --all --graph --decorate --oneline |
This file contains hidden or 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
CREATE TABLE example_table ( | |
nid INT(11) NOT NULL, | |
plain_text_field VARCHAR(32, | |
numeric_field INT(11), | |
boolean_field INT(1), | |
timestamp_field INT(8), | |
PRIMARY KEY(nid) | |
); |
This file contains hidden or 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
mysqlcheck -o --all-databases |