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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => General | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Sets how many lines of history VIM has to remember | |
set history=700 | |
" Increasing undo limits | |
set undolevels=1000 |
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 | |
// Getting All nodes of a particular type | |
// In my example its node type news | |
$query = new EntityFieldQuery; | |
$query->entityCondition('entity_type', 'node') | |
->entityCondition('bundle', 'news') | |
->propertyCondition('status', 1); | |
$results = $query->execute(); |
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
$node = node_load( 9 ); | |
$date = $node->field_exam_date['und'][0]; | |
$date_object = new DateObject($date['value'], new DateTimeZone($date['timezone_db'])); | |
$date_object->setTimezone(new DateTimeZone($date['timezone'])); | |
return date_format_date($date_object, 'custom', 'Y m d h:m:s'); |
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
# Redirect root to /exploreap URI | |
RewriteRule ^$ /exploreap [R=301] | |
# Rewrite HTTP to HTTPS on some pages and sections | |
RewriteEngine on | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{REQUEST_URI} /user [NC,OR] | |
RewriteCond %{REQUEST_URI} /admin [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/exploreap/thank-you-for-subscribing$ [NC] | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L] |
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
Hook Webform Presave: http://drupalcontrib.org/api/drupal/contributions%21webform%21webform.api.php/function/hook_webform_submission_presave/7 | |
Writing to a csv or excel file : http://drupal.org/node/1177352 | |
File Save with entity(Very short and simple code): | |
$entity = entity_load($id); | |
$data = file_get_contents($localpath); | |
$destination = file_create_filename(basename($localpath), file_default_scheme() . '://yourdir/' ); | |
$file = file_save_data($data, $destination); | |
$entity->field_attachment[LANGUAGE_NONE][] = (array)$file; |
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
getUrlVars: function() { | |
var vars = [], hash; | |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for(var i = 0; i < hashes.length; i++) | |
{ | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); | |
vars[hash[0]] = hash[1]; |
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
**INLCUDE htpasswd** | |
To generate .htpasswd: | |
htpasswd -c ./.htpasswd admin | |
Add this in .htaccess: | |
AuthUserFile /home/test/public_html/.htpasswd | |
AuthGroupFile /dev/null |
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 | |
define('DOCROOT', dirname(__FILE__)); | |
spl_autoload_register('st_oop_autoload'); | |
/** | |
* Autoload Mechanism | |
*/ |