Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
@bangpound
bangpound / gist:194745
Created September 27, 2009 12:16
Semantic HTML drupal element
/**
* Implementation of hook_elements().
*/
function semanticviews_elements() {
return array(
'semantic_html' => array(
'#input' => FALSE,
'#html_element' => '',
'#pre_render' => array('semanticviews_html_element_pre_render'),
),
@bangpound
bangpound / Select all terms with no children.
Created October 9, 2009 17:19
Drupal 6 taxonomy SQL: select all terms with no children.
SELECT t.* FROM term_data t
INNER JOIN term_hierarchy h ON h.tid = t.tid OR h.parent = t.tid
WHERE t.vid = %d
GROUP BY t.tid
HAVING COUNT(t.tid) = 1
ORDER BY weight,name
@bangpound
bangpound / __layout.sass
Created November 12, 2009 00:28
Zen + Blueprint + Compass/Sass layout tricks
@import __base.sass
@import compass.sass
!zen_first_sidebar_width = !zen_blueprint_left_units * !blueprint_grid_outer_width
!zen_second_sidebar_width = !zen_blueprint_right_units * !blueprint_grid_outer_width
!zen_content_width = (!zen_blueprint_content_units * !blueprint_grid_outer_width) - !blueprint_grid_margin
!zen_gutter = !blueprint_grid_margin
!zen_navbar_height = 40px
!zen_page_width = !zen_first_sidebar_width + !zen_content_width + !zen_second_sidebar_width
$result = db_result(db_query('SELECT COUNT(*) AS registered_user_count FROM {users}'));
return t('%x number of people attending dcc2009', array('%x' => $result));
@bangpound
bangpound / gist:259775
Created December 18, 2009 21:36
show permissions which aren't handled by a feature.
module_load_include('inc', 'features', 'includes/features.user');
$perms = array_keys(_user_features_permission_map());
$defaults = array();
foreach (module_invoke_all('user_default_permissions') as $permission) {
$defaults[] = $permission['name'];
}
foreach (array_diff($perms,$defaults) as $item) {
dpm($item);
@bangpound
bangpound / gist:259899
Created December 19, 2009 01:17
show variables that aren't strongarmed. delete variables from database that are.
foreach (ctools_export_load_object('variable') as $variable) {
if ($variable->export_type == EXPORT_IN_DATABASE) {
dpm($variable->name);
}
if ($variable->export_type == EXPORT_IN_CODE) {
variable_del($variable->name);
}
}
@bangpound
bangpound / ui.all.sass
Created January 21, 2010 20:03
jQuery UI 1.6 theme sass
// $Id$
//
jQuery UI screen structure and presentation
This CSS file was generated by ThemeRoller, a Filament Group Project for jQuery UI
Author: Scott Jehl, [email protected], http://www.filamentgroup.com
Visit themeroller.com
@import compass/utilities/general/reset.sass
@import compass/utilities/general/float.sass
@bangpound
bangpound / drupalContentTypeInClassAttribute.php
Created January 25, 2010 07:25
Semantic Views: add a field's value to the class attribute of its row.
<?php
/**
* Add content type to the class of the row.
*/
function MODULE_preprocess_semanticviews_view_unformatted(&$vars, $hook) {
if ($hook == 'semanticviews_view_unformatted__package__node_content_1') {
// The index in the field array is the simple field name and is consistent
// across joins. e.g. when the field is 'type', the field alias could be
// 'node_node_data_field_package_content_type' if it's at the end of a
<style type="text/css">
/* <![CDATA[ */
.road {
height: 28px;
background-color: #ccc;
border-color: black;
border-width: 2px;
border-top-style: solid;
border-bottom-style: solid;
position: absolute;
@bangpound
bangpound / Portfile
Created March 8, 2010 03:20
drush and drush_make Portfile for MacPorts
# $Id$
# Based on work of [email protected] that's in the MacPorts repository.
PortSystem 1.0
name drush
version 3.3
categories www php
platforms darwin