Skip to content

Instantly share code, notes, and snippets.

View keopx's full-sized avatar

Ruben Egiguren keopx

View GitHub Profile
@keopx
keopx / checklist.md
Last active August 29, 2015 14:07 — forked from juampynr/checklist.md
@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 / 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 / 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(
; 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 / 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
@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 / mymodule.install.php
Last active August 29, 2015 14:10
Adding multiple new fields to a table
<?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',
@keopx
keopx / gitconfig_log
Last active August 29, 2015 14:11
Git log decoration for see logs. Add lines to .git/config
git config --global alias.lg 'log --all --graph --decorate --oneline'
### OR ###
[alias]
lg = log --all --graph --decorate --oneline
@keopx
keopx / custom_module.install
Last active August 29, 2015 14:11
Custom table using views
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)
);