Skip to content

Instantly share code, notes, and snippets.

@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:
@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 / 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 December 9, 2014 12:24
settings.php for fox.com development
<?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 to this file is a
@ardnet
ardnet / .gitignore
Created December 21, 2014 21:35
.gitignore for Drupal development
# Ignore configuration files that may contain sensitive information.
#sites/*/*settings*.php
# Ignore paths that contain generated content.
files/
sites/*/files
sites/*/private
tmp
private
@ardnet
ardnet / gist:b31bb211a21134a7b07d
Last active August 29, 2015 14:18
Debian DevOps
# Check Linux version
cat /etc/*release
# Update Linux distribution
sudo apt-get update
# Upgrade Linux distribution
sudo apt-get dist-upgrade
# Restart Apache
@ardnet
ardnet / Dockerfile
Last active November 13, 2016 17:21
Basic Dockerfile
FROM drupal:7-apache
MAINTAINER Pratomo Ardianto <ardi@email.com>
# Install packages
RUN apt-get update
RUN apt-get install -y \
git \
vim \
cron \
zip \
@ardnet
ardnet / docker-compose.yml
Last active November 22, 2016 08:26
Sample of docker-compose.yml
version: '2'
services:
ardiweb:
build: .
ports:
- "8080:80"
volumes:
- ./docroot:/var/www/html
links:
- ardimysql
@ardnet
ardnet / gist:0de8c7bc29127bdfc9070c4e21c1b0b3
Last active December 7, 2016 08:07
_fb_connect_likes_fetch()
<?php
function _fb_connect_likes_fetch($url, $record = array(), $i = 0, $no_flag = FALSE) {
$flag = TRUE;
if ($flag === TRUE) {
$req = drupal_http_request($url)->data;
$chunk = drupal_json_decode($req);
if ($chunk['data'] == null) {
return $record;
@ardnet
ardnet / d8_import_config.yml
Last active February 22, 2017 04:45
D8 CSV Import Config
type: content_type
id: import_kodepos
label: Import Kode Pos
source:
plugin: csv
path: '/Users/ardnet/kode_pos.csv'
header_row_count: 1
keys:
- KodePos
process: