Skip to content

Instantly share code, notes, and snippets.

View danreb's full-sized avatar

Adolfo G. Nasol danreb

View GitHub Profile
@danreb
danreb / README.txt
Created August 3, 2012 09:55
This is a powerful scripts that will illiminate all bugs in your code, just make sure to backup as this code is powerful, shell_exec should be enabled to make this work. You can execute this file in command line ( shell or cmd )
USAGE:
First thing first - Make a backup of all your files. !Important
Execution Method 1
Just drop this line inside the folder where your PHP program or buggy scripts reside then open command line and go to this directory. Execute the scripts by typing the command "php bug_fixer.php" without a quote, then press enter and just wait, then VIOLA! all bugs are gone! Congrats!
Execution Method 2
@danreb
danreb / commercehook.module
Created September 15, 2012 18:24
Override the Drupal Commerce cart summary using the theme preprocess function in either module or theme.
<?php
/*
* Implementation of hook_preprocess_commerce_line_item_summary
*
*/
// Replace the name of the hook with your theme or module name.
function HOOK_preprocess_commerce_line_item_summary(&$variables) {
// Replace the label ( default to Total ) with your own label
@danreb
danreb / Readme.txt
Created September 17, 2012 06:22
Making division with class twins with the same heights using jQuery Equalheights plugin in Drupal theme
Make sure you include jquery equal heights plugin before using this snippet of code. Add entry reference to your scripts in your theme .info file.
@danreb
danreb / template.php
Created September 25, 2012 01:31
Example code for overriding specific menu in Drupal 7 using theme_menu_tree()
<?php
/**
* Implements hook_menu_tree
* Wrap main menu with 2 division (Bootstrap)
*
*/
function speedy_menu_tree__main_menu($vars) {
return '<div class="navbar"><div class="navbar-inner"><ul class="nav">' . $vars['tree'] . '</ul></div></div>';
}
@danreb
danreb / check_function.php
Created October 5, 2012 00:14
PHP code snippet that to check if particular function is enabled or can be use, in this snippet, were checking shell_exec()
<?php
// Replace with any function
if (function_exists('shell_exec')) {
echo "The function shell_exec() is available.";
} else {
echo "The function shell_exec() not available.";
}
?>
@danreb
danreb / shell_snippet.sh
Created October 5, 2012 01:28
List of Useful Linux Shell command
# Reload .bashrc after editing, example after editing and adding the Drush alias
# to user specific aliases and functions -> alias drush="~/drush/drush"
# Execute the below shell commands
source ~/.bashrc
# This one goes to .bash_profile
# User specific environment and startup programs
@danreb
danreb / page.tpl.php
Created October 5, 2012 05:51
Drupal Theme Specific Settings
<?php
/*
* Usage
* Insert to specific code block, div or regions
*
*/
<?php if (theme_get_setting('footer_credits')): ?>
<span class="credits"><?php print t('Powered by: '); ?> <a href="http://github.com/danreb/abtik">Abtik Base Theme</a></span>
@danreb
danreb / Reference.txt
Created October 8, 2012 02:41
Drupal 7 code snippets for customizing user login and creating custom template file
http://drupal.org/node/350634
http://highrockmedia.com/blog/customizing-user-login-page-drupal-7
@danreb
danreb / README.txt
Created October 8, 2012 03:13
Remove Login Tab
This will just remove log-in tab for customizing in theme, use this together with the code found in https://gist.github.com/3850448
@danreb
danreb / template.php
Created November 6, 2012 03:48
Change Add to Cart button label in Drupal Commerce for specific product.
<?php
/**
* Implements hook_form_alter
*
*/
function arma_form_alter(&$form, $form_state, $form_id) {
if ($form_id === 'commerce_cart_add_to_cart_form_2' || $form_id === 'commerce_cart_add_to_cart_form_1') {
$form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value'] = t('Buy Corporate Membership');
}