This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
jQuery(document).ready(function () { | |
if(jQuery.browser.msie){ | |
if(parseFloat(jQuery.browser.version) < 9){ | |
//Versions of IE less than 8 | |
window.location = "http://google.com"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Load the view. | |
$view = views_get_view('news_master'); | |
//set the display. | |
$view->set_display('block'); | |
//set the limit. | |
$view->set_items_per_page(8); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_block_info(). | |
*/ | |
function mymodule_block_info() { | |
$blocks = array(); | |
$blocks['my_block'] = array( | |
'info' => t('Master News Sticky'), | |
); | |
return $blocks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
@interface AppDelegate : NSObject <NSApplicationDelegate> | |
//The UI have a pushbutton, textfield1 & textfield2. | |
//create an action for push button with below code. (ctrl + drag to AppDelegate.h) | |
- (IBAction)button:(id)sender; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar --exclude='path/to/exclude' -zcvf filename-you-want.tar.gz /directory/to/archive | |
#also possible in multiple | |
tar --exclude='path/to/exclude1' --exclude='path/to/exclude2' -zcvf filename-you-want.tar.gz /directory/to/archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ccl_block_contextual_links_view_alter(&$element, &$items) { | |
if (isset($element['#element']['#block']) && $element['#element']['#block']->delta == "custom_module") { | |
$element['#links']['edit_f_block'] = array( | |
'title' => 'Change Content', | |
'href' => url('admin/config/front/block', array('absolute' => TRUE)), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_views_query_alter(). | |
* | |
* This disables distinct and turns LEFT joins into INNER joins. This increases | |
* performance. | |
*/ | |
function my_module_views_query_alter(&$view, &$query) { | |
if ($view->name == "my_view") { | |
$query->table_queue['content_type_article']['join']->type = 'INNER'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_module_product_add($pid,$quantity=1){ | |
if ($product = commerce_product_load($pid) ) { | |
global $user; | |
//uid of the logged in user | |
$uid = $user->uid; | |
$line_item = commerce_product_line_item_new($product, $quantity); | |
$line_item->field_ticket_type['und'][]['value'] = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Unblock user in bulk operations | |
* Implements hook_action_info(). | |
*/ | |
function unblock_user_action_info() { | |
return array( | |
'unblock_user_unblock_action' => array( | |
'label' => t('Unblock the user'), | |
'type' => 'user', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_module_html_head_alter(&$head_elements) { | |
foreach ($head_elements as $key => $element) { | |
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') { | |
unset($head_elements[$key]); | |
} | |
} |
OlderNewer