Skip to content

Instantly share code, notes, and snippets.

View phillipadsmith's full-sized avatar

Phillip Smith phillipadsmith

View GitHub Profile
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 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%'
<?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="[email protected]"
exporter="[email protected]"
>
<bug>
<%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);
@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
<%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
@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:101436
Created April 25, 2009 01:04
Display the first-level elements of a story given its 'id'
SELECT f.id,ft.name,ft.key_name,f.place,f.object_order
FROM story_field f,field_type ft
WHERE f.field_type__id = ft.id and ft.active = 't'
and f.parent_id = (
select t.id from story_element t,element_type et,at_type at
where t.element_type__id=et.id and t.active='t' and et.active='t'
and et.type__id=at.id and t.object_instance_id = (
select max(id) from story_instance where story__id = 50706
)
and at.top_level='t'
@phillipadsmith
phillipadsmith / gist:101435
Created April 25, 2009 01:04
Reactivate deactivated contributor
update member
set active = True
where id in (
select distinct sc.member__id
from story__contributor sc
inner join story_instance si on sc.story_instance__id = si.id
where si.story__id = ID OF YOUR STORY
);