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
#!/bin/bash | |
# activate extended pattern matching | |
shopt -s extglob | |
for f in "$@"; do | |
filename="$(basename "$f")" | |
dirpath="$(dirname "$f")" | |
# Get file extension |
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 | |
/** | |
* hook_form_alter() | |
* | |
* Switch quantity field from input text to select in add_to_cart forms | |
* Supports both standard add_to_cart, as shipped in commerce framework | |
* as well as ajax add_to_cart forms implemented by dc_ajax_add_cart module | |
* | |
* It also supports quantity fields as they appear in view cart form, both with |
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 | |
/** | |
* Quick CSV parsing in Drupal 7, using CSV parser library in the Feeds module. | |
* Default encoding expected to be UTF8. | |
* | |
*/ | |
// Custom variables, adjust to your needs | |
$file_name = 'public://custom_path_to_my_file.csv' | |
$delimiter = ';'; |
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 | |
/** | |
* This snippet adds all nodes belonging to a specific node type to all | |
* entityqueues found in the system, defined by Entityqueue module | |
* Customize to your own needs by modifying relevant parts of the code. | |
* @see https://www.drupal.org/project/entityqueue | |
*/ | |
// Get all available entityqueue queues | |
$all_queue_names = variable_get('entityqueue_queue_names', array()); | |
foreach ($all_queue_names as $queue_name) { |
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
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# Customize specific IP address which should have access to the live site | |
RewriteCond %{REMOTE_ADDR} !^11\.22\.33\.44 | |
# Customize name of your maintenance mode template file | |
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC] | |
# Only images and CSS files are allowed. Customize to allow Javascript or other image extensions | |
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css) [NC] |