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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 | |
/** | |
* @file views-view-grid.tpl.php | |
* Default simple view template to display a rows in a grid. | |
* | |
* - $rows contains a nested array of rows. Each row contains an array of | |
* columns. | |
* | |
* @ingroup views_templates | |
*/ |
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 | |
/** | |
* An example form showing how to use tokens. | |
*/ | |
function my_token_form($form_state) { | |
$form = array(); | |
// An example element with a value that accepts tokens. | |
$form['title_text'] = array( | |
'#type' => 'textfield', | |
'#title' => t('Title'), |
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
/** | |
* Some elements like headers or divs cannot gain focus. This script shows how you can enable this. | |
*/ | |
// Set the tabindex to 0 so the element can gain focus. To maintain natural tab flow | |
// you should use 0. | |
$('h1').attr('tabindex', '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 | |
/** | |
* @file | |
* Hide the page title on a page view snippet. | |
*/ | |
/** | |
* Implements template_process_page(). | |
* | |
* Removes the regular page title from news pages. |
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
// Reset addthis so it can be reloaded. | |
// This is very useful if you have generated content contain an AddThis widget. | |
if (window.addthis){ | |
window.addthis = 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
/** | |
* @file | |
* This snippet shows how you can run drupal from a different host behind a proxy. | |
* Include this code at the bottom of your settings.php file. | |
*/ | |
// Set the hosts that are allowed to be proxied to this drupal installation. | |
$conf['reverse_proxy_addresses'] = array('example.com', 'example2.com'); | |
// If the request was proxied from a different domain we change the internal URL. | |
if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && in_array($_SERVER['HTTP_X_FORWARDED_HOST'], $conf['reverse_proxy_addresses'])) { |
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
# Add this code to your VCL configuration. | |
# | |
# I assume a default backend has already been configured. | |
# If different from the default backend, add one for the host to proxy to. Note that these | |
# values are just examples. | |
backend proxy_host { | |
.host = "proxy_host.dev"; | |
.port = "8080"; | |
} |
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 | |
/** | |
* Migration class for migrating the source translations. | |
*/ | |
class MySourceTranslationMigration extends Migration { | |
// Nothing special here. Just set up a node migration, migrating to nodes | |
// that will serve as translation sources. | |
// ... |
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 | |
// Replace by a space because decode_entities will replace it by | |
// ASCII code 160. See http://php.net/manual/en/function.html-entity-decode.php. | |
// Replacing chr(160) afterwards results in an unknown char for some | |
// reason. | |
// Note that strtotime will result in FALSE if ASCII code 160 is present in the string. | |
$value = str_replace(' ', ' ', $value); |
OlderNewer