Skip to content

Instantly share code, notes, and snippets.

View juampynr's full-sized avatar

Juampy NR juampynr

View GitHub Profile
@juampynr
juampynr / popusername.info
Last active December 12, 2015 04:49
Populate username field with First name and Last name
name = Populate username
description = Populates username field
php = 5.1
core = 7.x
@juampynr
juampynr / mymodule.info
Last active June 9, 2023 21:53
Drupal 7 Views 3 custom field handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
<?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 December 19, 2015 22:48
PHP isset() and empty() black magic

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 12:21
Blink SIP client installation on Ubuntu 13 (saucy) and 14 (trusty)
  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 December 23, 2015 19:39
Drupalcontribute template

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 March 10, 2020 10:32
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
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 December 30, 2015 05:48
Drupal 7's upgrade path
<?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 January 3, 2016 08:19
Drupal 7: Common use cases on database updates.
<?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 January 29, 2014 14:14
Drupal: Setting up Apache Solr locally when using aquia_solr module

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: