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
// Load selected & not-selected classes when page loads | |
$('input[type=radio]').filter(':checked').parent().addClass('selected'); | |
$('input[type=radio]').filter(':not(":checked")').parent().addClass('not-selected'); | |
// When radio buttons are changed add classes | |
$('form').once('selected-radio-listen').on( | |
"change", | |
"input[type=radio]", | |
function () { | |
// Get all related inputs. |
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
1. Configure your Vagrant box to use a private network and assign an IP: | |
config.vm.network 'private_network', ip: 192.168.56.101 | |
2. Open the guest VM and add an entry to the hosts file (/system32/drivers/etc/hosts on Windows) | |
192.168.156.101 mysite.local | |
3. You may need to add a hosts-only network adapter to the second guest VM (this can be done in the VirtualBox config for that VM) | |
This can be very useful for testing a website served by a vagrant box on a Windows VM with Internet Explorer. |
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_custom_theme(). | |
* Switch to a custom theme when editing or adding a specific node type. | |
*/ | |
function MYMODULE_custom_theme() { | |
$args = arg(); | |
$node_type = 'my_node_type'; // Node type. | |
$theme = 'mytheme'; // Theme machine name. | |
if(isset($args[2]) && $args[0] == 'node' && $args[2] == 'edit') { |
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
// Get the value of a field. | |
$my_field = field_get_items('user', $user, 'field_my_field_name'); | |
$my_field_value = field_view_value('user', $user, 'field_my_field_name', $my_field[0]); | |
print $my_field_value['#markup']; | |
// Render a field. | |
$entity = entity_load('1'); | |
$my_node_field = field_view_field('node', $entity, 'field_my_field_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
# Clean, simple and slick. All on one line. | |
# It is recommended to use with a dark background and the font Inconsolata. | |
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. | |
# Based on YS theme | |
# Machine name. | |
function box_name { | |
[ -f ~/.box-name ] && cat ~/.box-name || hostname -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
#!/bin/bash | |
# ################################################################################ Apache SolR | |
# README: | |
# | |
# This script will install Apache Solr and run using Jetty | |
# | |
HELP=" |
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
Useful for anonymous users & debugging Drupal hook_mail and hook_mail_alter. Pretty-prints an object | |
drupal_set_message('<pre>' . print_r($account, TRUE) . '</pre>'); |
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
/* | |
* Implements template_preprocess_html() | |
*/ | |
function YOURTHEME_preprocess_html(&$variables, $hook) { | |
// Get the current space and output as a class in the body for use elsewhere | |
$space = spaces_get_space(); | |
// Works for Taxonomy spaces | |
if(!empty($space->term->name)) { | |
// Format nicely |
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
cd /path/to/drupal | |
scripts/password-hash.sh 'mynewpassword' | |
-> Add hash to user 1 in the DB |
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
/** | |
* Code block comment | |
*/ | |
$variable: 1; | |
$variable: 2; | |
.selector { | |
@extend %placehold-extender; | |
@include functionname(); |
OlderNewer