Skip to content

Instantly share code, notes, and snippets.

@ardnet
ardnet / custom.module
Last active August 29, 2015 14:07
Drupal alter fields using hook_views_pre_build()
/**
* Reference: http://stackoverflow.com/questions/9083292/how-to-remove-a-field-from-views-3-programmatically
*/
function custom_views_pre_build(&$view) {
if ($view->name == 'video_playlist_node_rotator') {
$fields_to_remove = array('field_season_number','field_episode_number');
foreach ($fields_to_remove as $field_name) {
unset($view->field[$field_name]);
unset($view->display_handler->handlers['field'][$field_name]);
@ardnet
ardnet / settings.php
Created September 28, 2014 15:09
settings.php for VDD of Baker-Bakes
<?php
/**
* @file
* Drupal site-specific configuration file.
*
* IMPORTANT NOTE:
* This file may have been set to read-only by the Drupal installation
* program. If you make changes to this file, be sure to protect it again
* after making your modifications. Failure to remove write permissions
@ardnet
ardnet / gist:bd88ea0e63a1c2a07c62
Last active August 29, 2015 14:05
"Remember" (X-Labs) Deployment Guide

Preparation

Please ensure this app already been install in your local:

  • nodejs
  • Elasticsearch (ES)
  • MongoDB

Elasticsearch schema deployment

  1. Once Elasticsearch has been installed and running, install this Google Chrome extension as REST client.
  2. Create the ES index by running this command in REST client: curl -XPUT http://localhost:9200/note
  3. Create the ES type and data schema by running this command in REST client: curl -XPUT http://localhost:9200/note/entry3/_mapping, with the value as below: