Skip to content

Instantly share code, notes, and snippets.

Avatar

Juampy NR juampynr

View GitHub Profile
@juampynr
juampynr / popusername.info
Last active Dec 12, 2015
Populate username field with First name and Last name
View popusername.info
name = Populate username
description = Populates username field
php = 5.1
core = 7.x
@juampynr
juampynr / mymodule.info
Last active Feb 13, 2022
Drupal 7 Views 3 custom field handler
View mymodule.info
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
View html.tpl.php
<?php
/**
* @file
* Default theme implementation to display the basic html structure of a single
* Drupal page.
*
* Variables:
* - $css: An array of CSS files for the current page.
* - $language: (object) The language the site is being displayed in.
@juampynr
juampynr / isset_and_empty.md
Last active Dec 19, 2015
PHP isset() and empty() black magic
View isset_and_empty.md

When dealing with arrays in PHP, checking for an index like if ($a['foo']) throws a PHP warning.

There are two ways to avoid these warnings: one is using isset(), which checks the existance of an array index. The second one is empty(), which not only checks for the existence of the array index, but also that the value that contains is not empty (not NULL, 0, '' or FALSE).

Here are some console examples:

juampy@juampybox $ php -a
php > $a = array('foo' => 'asdfasd');
php &gt; 
@juampynr
juampynr / README.md
Last active May 29, 2020
Blink SIP client installation on Ubuntu 13 (saucy) and 14 (trusty)
View README.md
  1. Install python with sudo apt-get install python.

  2. Download Blink sources from http://download.ag-projects.com/BlinkQt

  3. Extract contents and open the terminal.

  4. Change directory into the Blink folder and run sudo python setup.py install

  5. Install the following Python libraries:

@juampynr
juampynr / README.md
Last active Dec 23, 2015
Drupalcontribute template
View README.md

A DrupalConTribute is a local and remote meetup in which a group of people contribute to a Drupal module. Normally one of the module maintainers is available during the event in order to provide guidance and commit/review patches

Dates

Normally this is held over a whole day.

Location

The local group will meet while remote people can participate through common IRC channels and Google Hangout.

Organisation

@juampynr
juampynr / readme.txt
Last active Mar 10, 2020
JQuery + Drupal block example. Used to compare with an AngularJS + Drupal approach. Details at https://www.lullabot.com/blog/article/move-logic-front-end-angularjs
View readme.txt
JQuery + Drupal block example.
Used to compare with an AngularJS + Drupal approach.
Details at https://www.lullabot.com/blog/article/move-logic-front-end-angularjs
@juampynr
juampynr / upgradepath.drush.inc
Last active Dec 30, 2015
Drupal 7's upgrade path
View upgradepath.drush.inc
<?php
// NOTE This has been moved to https://www.drupal.org/project/upgradepath
/**
* @file
* Runs a set of steps to upgrade a database to be in line with code.
*/
/**
* Implements hook_drush_command().
@juampynr
juampynr / mymodule.install
Last active Jan 3, 2016
Drupal 7: Common use cases on database updates.
View mymodule.install
<?php
/**
* Disable and uninstall a feature module.
*
* Note: see some edge cases where some exported components like content types
* need to be removed manually.
*/
function mymodule_update_7100() {
// Note that this does not take care of disabling modules that depend
@juampynr
juampynr / README.md
Created Jan 29, 2014
Drupal: Setting up Apache Solr locally when using aquia_solr module
View README.md

Drupal: Setting up Apache Solr locally when using aquia_solr module

Acquia Search is a module within https://drupal.org/project/acquia_connector used on sites hosted at the Aquia Cloud.

By default, all environments except production will perform searches on Aquia's Solr instance in Read Only mode.

Setting up a local Solr Server

There are a few gotchas in setting a Solr Server locally when using aquia_search. Here is a step by step guide: