Skip to content

Instantly share code, notes, and snippets.

View nigelheap's full-sized avatar

Nigel nigelheap

View GitHub Profile
jQuery(".clear_return").focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
SELECT * FROM term_data td JOIN term_hierarchy th ON th.tid = td.tid WHERE th.parent = 2761
@nigelheap
nigelheap / program_tabs.php
Created April 29, 2011 05:05
program_tabs.php
/**
* page callback for program tabs
*/
function syn_custom_program_tab($node, $term_name) {
//$term = taxonomy_get_term_by_name($term_name);
$terms = array();
$term = array();
$parent = taxonomy_get_term_by_name($node->title);
$parent = end($parent);
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("projects.itomic.com") {
body{ background:#111 !important;}
body.mceContentBody{ background:#FFF !important;}
#tabnav{ padding:0 !important;}
#tabnav li{ padding:0 !important; margin-right:2px !important; border-bottom:none !important;}
#tabnav span.content{ background-image:none !important; background:#333 !important; padding:6px 10px !important; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px;}
#header4{background:#E6E6E6 !important;height:20px !important;}
#header2{background:none !important; margin:0 !important;}
<?php
public function get_children_ids($node_id, $tree_table, $left_col, $right_col, $depth = 1){
$result = $this->EE->db->query(
"SELECT node.*, (COUNT(parent.node_id) - (sub_tree.depth + 1)) AS depth
FROM ".$tree_table." AS node,
".$tree_table." AS parent,
".$tree_table." AS sub_parent,
(
SELECT node.node_id, (COUNT(parent.node_id) - 1) AS depth
FROM ".$tree_table." AS node,
/* Scrollbar for webkit browsers only
******************************************/
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-width: 1024px) {
html {overflow-y: auto; background-color: transparent;}
body {position: absolute; top: 0; left: 0; bottom: 0; right: 10px; overflow-y: scroll; overflow-x: hidden;}
}
::-webkit-scrollbar { width: 8px; height: 10px; }
@nigelheap
nigelheap / breadcrum_hell.php
Created June 8, 2011 05:08 — forked from nicksantamaria/gist:1013816
Psuedo-code for getting the parent page's title when using urls as hierarchy
<?php
// Get the requested URL alias and explode into array
$q = trim($_SERVER['REQUEST_URI'], '/');
$arg = explode('/', $q);
// Shorten the URL by 1 argument
$newArg = array_slice($arg, 0, (count($arg) - 1));
// Get the menu item for the new URL
// ==UserScript==
// @name projects.itomic.com.hide.old.tasks
// @namespace projects.itomic.com.hide.old.tasks
// @description projects.itomic.com.hide.old.tasks
// @include http://projects.itomic.com/cms/?module=timesheet&action=add
// ==/UserScript==
(function() {
<?php
/**
* Loads a group ID from a node ID
*/
function artroom_ui_og_load_from_nid($nid) {
static $groups;
if (empty($groups)) {
$q = db_select('og');
$q->fields('og', array('gid', 'etid'));
function foo( bar ) {
jQuery.data(document.body, 'response', 4);
if ( bar )
{
$.get('/something.php', function(response) {
jQuery.data(document.body, 'response', response);
});