Skip to content

Instantly share code, notes, and snippets.

View phillipadsmith's full-sized avatar

Phillip Smith phillipadsmith

View GitHub Profile
@phillipadsmith
phillipadsmith / gist:101444
Created April 25, 2009 01:29
also_this_topic.mc
<%args>
@secondary_categories
$skip_story_id => undef
$max_return => 5
</%args>
<%perl>
# setting max_return to "0" (either by passing in value when calling, or adjusting above), means return everything.
my $count_returned=0; # default to returning everything found.
my $return_limit; #this is passed to the Bric::Biz... call -- requires special handling.
if(0==$max_return){ #unlimited
@phillipadsmith
phillipadsmith / gist:101445
Created April 25, 2009 01:30
also_this_topic_march_27.mc
<%args>
@secondary_categories
$skip_story_id => undef
$max_return => 5
</%args>
<%perl>
# setting max_return to "0" (either by passing in value when calling, or adjusting above), means return everything.
my $count_returned=0; # default to returning everything found.
my $return_limit; #this is passed to the Bric::Biz... call -- requires special handling.
if(0==$max_return){ #unlimited
<%args>
@secondary_categories
$skip_story_id => undef
$max_return => 5
</%args>
<%perl>
# setting max_return to "0" (either by passing in value when calling, or adjusting above), means return everything.
my $count_returned=0; # default to returning everything found.
my $return_limit; #this is passed to the Bric::Biz... call -- requires special handling.
if(0==$max_return){ #unlimited
@phillipadsmith
phillipadsmith / gist:101481
Created April 25, 2009 03:46
extract e-mail addresses
perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}' emails.txt | sort -u > output.txt
<%init>
# First, let's check for an associated media asset, which we need
my $media = $element->get_related_media or $burner->throw_error(
'Hey, you forgot to associate a media document! ',
'Please relate or upload an image for this story. ',
'You can upload JPEGs, GIFs, or PNGs.'
);
# Now let's re-size it for the thumbnail
my $image = $element->get_related_media;
my $thumb = $m->comp('/util/thumbnail.mc', image => $image);
<?xml version="1.0" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.bricolage.cc/bugzilla.dtd">
<bugzilla version="3.0"
urlbase="http://bugs.bricolage.cc/"
maintainer="marshall@exclupen.com"
exporter="phillip@communitybandwidth.ca"
>
<bug>
SELECT phillipadsmith_bricbugs.bugs.bug_id,
phillipadsmith_bricbugs.longdescs.bug_id,
phillipadsmith_bricbugs.bugs.bug_status,
phillipadsmith_bricbugs.bugs.short_desc,
phillipadsmith_bricbugs.bugs.bug_severity,
phillipadsmith_bricbugs.longdescs.thetext
FROM phillipadsmith_bricbugs.bugs
INNER JOIN phillipadsmith_bricbugs.longdescs
ON phillipadsmith_bricbugs.bugs.bug_id = phillipadsmith_bricbugs.longdescs.bug_id
WHERE phillipadsmith_bricbugs.bugs.bug_status LIKE '%NEW%'
SELECT phillipadsmith_bricbugs.bugs.bug_id,
phillipadsmith_bricbugs.longdescs.bug_id,
phillipadsmith_bricbugs.bugs.bug_status,
phillipadsmith_bricbugs.bugs.op_sys,
phillipadsmith_bricbugs.bugs.priority,
phillipadsmith_bricbugs.bugs.short_desc,
phillipadsmith_bricbugs.bugs.bug_severity,
GROUP_CONCAT(phillipadsmith_bricbugs.longdescs.thetext ORDER BY phillipadsmith_bricbugs.bugs.bug_id SEPARATOR '--')
FROM phillipadsmith_bricbugs.bugs
INNER JOIN phillipadsmith_bricbugs.longdescs
SELECT node.nid AS node_id,
FROM_UNIXTIME(node.created) AS created,
node.title,
nr.teaser,
nr.body AS text,
( SELECT GROUP_CONCAT( name SEPARATOR ':' ) AS name_list FROM ( term_data LEFT JOIN (term_node) ON term_data.tid = term_node.tid ) WHERE term_node.nid=node_id ) AS keywords,
CONCAT_WS("/","http://interact.newint.org",url_alias.dst) AS slug
FROM node,
term_node AS tn,
node_revisions as nr,
/**
* views template to output a view.
* This code was generated by the views theming wizard
* Date: June 26, 2009 - 12:34pm
* View: enews_dail_top_picks
*
* This function goes in your template.php file
*/
function phptemplate_views_view_list_enews_dail_top_picks($view, $nodes, $type) {
$fields = _views_get_fields();