Skip to content

Instantly share code, notes, and snippets.

View keopx's full-sized avatar

Ruben Egiguren keopx

View GitHub Profile
@keopx
keopx / Netbeans_Integration.txt
Last active August 29, 2015 14:09
Drupal CodeSniffer via console
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(
@keopx
keopx / Readme.txt
Created November 12, 2014 09:58
Install Xdebug and configure it with Netbeans
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
; 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;
@keopx
keopx / mymodule_views_data_alter.php
Created October 22, 2014 10:02
Use date filter for node created filter. With it we use date calendar and options.
<?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(
@keopx
keopx / views_datepicker.php
Last active August 29, 2015 14:07
Views datepicker format correctly
<?php
function publiviews_js_alter(&$js) {
$js['settings']['data'][] = array(
'better_exposed_filters' => array(
'datepicker_options' => array(
'dateformat' => 'dd-mm-yy',
)));
}
?>
@keopx
keopx / random_dday.sh
Created October 14, 2014 11:22
Sacar numeros para el sorteo de librecon
n=$RANDOM
# display random number between 1 and xxx.
echo $((RANDOM%146+1))
echo $((RANDOM%146+1))
@keopx
keopx / checklist.md
Last active August 29, 2015 14:07 — forked from juampynr/checklist.md
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
- Menu example
-- Tabs
-- Callback
- Page example
-- Permissions
- Block example
- Form example
-- Validate
-- Submit
-- Autocomplete
<?php
/**
* @file
* Runs a set of steps to upgrade a database to be in line with code.
*/
/**
* Implements hook_drush_command().
*/
function upgradepath_drush_command() {