Skip to content

Instantly share code, notes, and snippets.

View umandalroald's full-sized avatar
🎯
Focusing

Roald Umandal umandalroald

🎯
Focusing
View GitHub Profile
#!/usr/bin/env bash
RED='\033[0;31m'
LIGHTRED='\033[1;31m'
NC='\033[0m'
GREEN='\033[0;32m'
CURRENTUSER=$USER;
PURPLE='\033[0;35m'
BLUE='\033[0;34m'
@umandalroald
umandalroald / services_auth_apikeys.rules.inc
Created April 3, 2017 15:14
Drupal 7 rules integration for services_auth_apikeys
<?php
/**
* Implements hook_rules_action_info().
*/
function services_auth_apikeys_rules_action_info() {
return array(
'services_auth_apikeys_rules_action_generate_token_api_key' => array(
'label' => t('Generate token and api key on account creation'),
'group' => t('Services Auth Api Keys'),
@umandalroald
umandalroald / loading_and_setting_global_session_time_zone.txt
Last active December 19, 2016 06:06
Loading time zone info in mysql and changing your default global and session time zone
// Load the list of time zone in mysql after this login to your mysql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p --force mysql
// By default your mysql time zone is set to SYSTEM
// But what if you want to change your global and session time zone?
(set global and session time zone)
SET @@global.time_zone = 'Asia/Manila'
SET @@session.time_zone = 'Asia/Manila'
@umandalroald
umandalroald / ElasticSearch.sh
Created May 1, 2016 05:22 — forked from ricardo-rossi/ElasticSearch.sh
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
function email_client() {
$late = array();
$schedules = views_get_view_result('employee_schedule', 'page_2');
$check_sched = views_get_view_result('attendance_checker', 'page');
$schedule_emp = array();
foreach($schedules as $schedule) {
$schedule_emp[] = array(
'uid' => $schedule->_field_data['nid']['entity']->field_assign_user['und'][0]['uid'],
'emp_name' => $schedule->_field_data['nid']['entity']->title,
'schedule' => $schedule->_field_data['nid']['entity']->field_schedule['und'],
@umandalroald
umandalroald / table.php
Created September 5, 2015 02:07
Creating a table using theme table drupal
function theme_inventory_form($variables) {
$form = $variables['form'];
$limit = 10;
$output = "";
drupal_add_js('misc/tableselect.js');
$header = array(
array('data' => t(' ')),
array('data' => t('SKU')),
@umandalroald
umandalroald / tableselect.php
Last active September 4, 2015 00:14
Creating table using tableselect form api (Drupal 7) with select all and pagination. data is loaded using node_load and field_collection_item_load
function inventory_form($form, &$form_state) {
global $user;
$limit = 10;
module_load_include('module', 'profile2', 'contrib/profile2_page');
$profile = profile2_by_uid_load($user->uid, 'employee');
$store = node_load($profile->field_store_branch['und'][0]['target_id']);
$inventory = node_load($store->field_inventory['und'][0]['target_id']);
$header = array(
@umandalroald
umandalroald / gist:11379707
Last active August 29, 2015 14:00
A simple example of automation script downloading and enabling modules in drupal using bash scripting and drush.
#!/bin/bash
clear
echo "Downloading basic module for development..."
# Download all modules that are needed
drush dl admin_menu
drush dl module_filter
drush dl pathauto
drush dl ckeditor