Skip to content

Instantly share code, notes, and snippets.

View nlively's full-sized avatar

Noah Lively nlively

View GitHub Profile
<?php
//collects the nodeword data
$query ='SELECT id, type, name, content FROM {nodewords} where name = '."'description' or name = 'keywords'";
$result = db_query($query);
//collect and place nodeword data in array for metatag data
foreach ($result as $row) {
if ($row->type == '5')
$nodewords_data[$row->id]['entity_type'] = 'node';
else
continue;
<?php
// Including citygrid API
include "citygrid-places-api-class.php";
/*
* class ExternalLisitngService with methods to call citysearch API,update nodes on the basis of data
* from listing site,to count reviews from users,return all reviews form users
*
<?php
/*
* Doubts
* 1.there is no more need of lookupListing as we are having standardizeListingFormat()
* 2.Will the implementation of applyListingDataToLocalRecord() will go like this..
* 3.staticfunction of a class can access non static class variables?....
* 4.Need documentation for getListingData()
*/
<?php
/*
* Doubts
* 1.there is no more need of lookupListing as we are having standardizeListingFormat()
* 2.Will the implementation of applyListingDataToLocalRecord() will go like this..
* 3.staticfunction of a class can access non static class variables?....
* 4.Need documentation for getListingData()
*/
@nlively
nlively / show_preview_image.php
Created March 30, 2012 15:10
Drupal: Display an image from a node in a form.
<?php
$node = node_load(NID_HERE);
if ($node->field_image[LANGUAGE_NONE][0]['fid']) {
$file = file_load($node->field_image[LANGUAGE_NONE][0]['fid']);
$form['image_preview'] = array(
'#markup' => theme('image', array('uri' => $file->uri));
@nlively
nlively / drupal_cloc.sh
Created April 5, 2012 18:59
Count lines of code in Drupal project
#!/bin/bash
find . \( -iname '*.inc' -o -iname '*.php' -o -iname '*.install' -o -iname '*.module' -o -iname '*.info' -o -iname '*.js' -o -iname '*.css' \) -exec wc -l {} + | sort -n
@nlively
nlively / query.sql
Created April 27, 2012 17:04
Service item retrieval
SELECT
jp.*,
si.description, si.service_id
FROM sun_sundocfilings_jurisdiction_prices jp
JOIN sun_sundocfilings_service_items si
ON jp.service_id = si.service_id
AND jp.item_id = si.guid
WHERE jurisdiction_id = 'd273a29a-60ea-e011-9f2a-485b397450b7'
AND NAME LIKE '%Articles%';
@nlively
nlively / gist:2586520
Created May 3, 2012 15:31 — forked from kumarmanish/gist:2586390
docret.php
Array
(
[group_1] => Array
(
[0] => stdClass Object
(
[id] => 439
[guid] => f2c93d48-98ad-49a8-815a-a0050087fc9e
[jurisdiction_id] => d273a29a-60ea-e011-9f2a-485b397450b7
[name] => Retrieval- WEB (Articles of Formation- Plain)
@nlively
nlively / gist:2645069
Created May 9, 2012 14:51 — forked from arpitr/gist:2644788
site automation code put in a separate function and node structure for Mobile Website has been changed
<?php
/**
* Implementation of hook_ca_action().
*/
function webmobilize_ca_action() {
$order_arg = array(
'#entity' => 'uc_order',
'#title' => t('Order'),
);
@nlively
nlively / service_form.php
Created September 25, 2012 00:04
service_form.inc
<?php
$services = array (
"Sunday School" => "Sunday School",
"11AM" => "11AM",
"6PM" => "6PM",
"7PM (Tuesday)" => "7PM (Tuesday)"
);
$ratio = array (
50 => "Standard (4:3)", // put in the real term IDs here
51 => "Widescreen (16:9)",