Skip to content

Instantly share code, notes, and snippets.

View arpitr's full-sized avatar

Arpit arpitr

  • Srijan Aravali Technologies
  • Goa
View GitHub Profile
@arpitr
arpitr / gist:2644788
Created May 9, 2012 14:17
site automation code put in a separate function and node structure for Mobile Website has been changed
<?php
/**
* Implementation of hook_ca_action().
*/
function webmobilize_ca_action() {
$order_arg = array(
'#entity' => 'uc_order',
'#title' => t('Order'),
);
@arpitr
arpitr / hook_uc_order()
Created May 9, 2012 15:38
$order, $order_product passed as argument
<?php
/**
* Implementation of hook_ca_action().
*/
function webmobilize_ca_action() {
$order_arg = array(
'#entity' => 'uc_order',
'#title' => t('Order'),
);
@arpitr
arpitr / gist:2645688
Created May 9, 2012 15:41
$order, $order_product are passed as arguments and $node->title = $order_id is changed to $node->title = $order->order_id;
<?php
/**
* Implementation of hook_ca_action().
*/
function webmobilize_ca_action() {
$order_arg = array(
'#entity' => 'uc_order',
'#title' => t('Order'),
);
@arpitr
arpitr / gist:2653209
Created May 10, 2012 14:05
db query added to change the username and pass after site creation with default admin/admin
<?php
/**
* Implementation of hook_ca_action().
*/
function webmobilize_ca_action() {
$order_arg = array(
'#entity' => 'uc_order',
'#title' => t('Order'),
);
@arpitr
arpitr / gist:92cb564944e3115161f8
Last active August 29, 2015 14:23
Screen Handy Commands
#Screen
#Run a task and detach
screen -S <Name Your Screen> -d -m <yourcommand>
#List screens
screen -ls
#Attach to a screen
screen -r <initials of screen id>
- SSH with password
- Add alias on bashrc
sudo apt-get install sshpass
#Then prepend your ssh/scp command with
sshpass -p '<password>' <ssh/scp command>
@arpitr
arpitr / watchdog.php
Last active November 18, 2016 07:24
Drupal Watchdog Object
watchdog('custom_debug', 'Debug Global User Object for @user_name, user object: !user', array('@' => $user->name, '!node' => '<pre>' . check_plain(print_r($user, TRUE)) . '</pre>'), WATCHDOG_ERROR);
#! /bin/bash
MYSQL="mysql -h <hostname> -u <username> -<password> -D <DATABASENAME>"
$MYSQL -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQL
unset MYSQL
@arpitr
arpitr / watchdog.php
Last active March 11, 2016 10:09
Drupal Watchdog Objects and Array
watchdog('module_name', 'Your Object: !object', array('!object' => '<pre>' . check_plain(print_r($object, TRUE)) . '</pre>'), WATCHDOG_ERROR);
@arpitr
arpitr / sample_hook.php
Created December 22, 2015 10:59
drupal_hook_sample
/**
* Implements hook_node_insert
*/
function mymodulename_node_insert($node) {
// Get Node Author.
$author = $node->author;
// Use Drupal Mail
send_mail($to=$author);
}