Skip to content

Instantly share code, notes, and snippets.

@andeersg
andeersg / gist:7195514
Created October 28, 2013 11:50
Sass mediaquery mixin
@mixin breakpoint($point) {
@if $point == desktop {
// Larger than tablets.
@media (min-width: 1210px) { @content; }
}
@else if $point == tablet {
// Tablets, go from 4 to 2 and 2 to 1.
@media (max-width: 1209px) { @content; }
}
@else if $point == mobile {
@andeersg
andeersg / is_module_enabled
Created June 24, 2013 07:54
Check if Drupal 7 module is enabled.
/**
* param string $module
* Name of the module.
*
* return int
* 1 or 0
*/
function is_module_enabled($module) {
$result = db_query('SELECT s.status FROM system s WHERE s.name = :name AND s.type = :type', array(':name' => $module, ':type' => 'module'));
$record = $result->fetchObject();
@andeersg
andeersg / hook_form_alter
Created June 24, 2013 07:51
Including javascript in form alter
/**
* Implements hook_form_alter().
*/
function fortytwo_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'block_admin_display_form':
$form['#attached']['js'] = array(
drupal_get_path('theme', 'fortytwo') . '/js/mousetrap.js' => array(
'scope' => 'footer',
),