Skip to content

Instantly share code, notes, and snippets.

my $starts;
if ( defined $ARGS{'Starts'} and $ARGS{'Starts'} =~ /\S/ ) {
$starts = new RT::Date( $session{'CurrentUser'} );
$starts->Set( Format => 'unknown', Value => $ARGS{'Starts'} );
}
and then later
Due => $due ? $due->ISO : undef,
Starts => $starts ? $starts->ISO : undef,
@tsibley
tsibley / gist:536022
Created August 18, 2010 20:11
Fold BPS copyright boilerplate in RT
func! s:FoldBPSCopyright()
if !exists( "b:foldedBPSCopyright" ) && (&ft == 'mason' || &ft == 'perl')
let b:foldedBPSCopyright = 1
set foldenable
try
" The idea is to only have the copyright block folded
silent /BEGIN BPS TAGGED BLOCK/,/END BPS TAGGED BLOCK/fold
catch
" do nothing
endtry
@tsibley
tsibley / gist:536040
Created August 18, 2010 20:19
Better mason file detection for vim
" Mason
au BufNewFile,BufRead * call s:FTmason()
func! s:FTmason()
let n = 1
while n < 10
let l = getline(n)
if l =~ '^%#' || l =~ '^\<%(INIT|init)\>' || l =~ '^\<%(ARGS|args)\>'
set filetype=mason
return
---
abstract: 'easy access to any pastebin'
author:
- 'Shawn M Moore, C<[email protected]>'
build_requires:
ExtUtils::MakeMaker: 6.42
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
generated_by: 'Module::Install version 1.00'
---
abstract: 'easy access to any pastebin'
author:
- 'Shawn M Moore, C<[email protected]>'
build_requires:
ExtUtils::MakeMaker: 6.42
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
generated_by: 'Module::Install version 1.00'
@tsibley
tsibley / viack
Created September 21, 2011 12:50
vim + ack
#!/bin/bash
grabnext=0
opts=''
for arg; do
if [[ $grabnext != 0 || ! "$arg" =~ ^- ]]; then
opts="+0 +/\\v$arg"
break
elif [[ "$arg" == "--" ]]; then
grabnext=1
fi
#!/bin/bash
middleware=""
if [[ "$1" == "markdown" || "$1" == "md" || "$1" == "wiki" ]]; then
wikilinks=0
if [[ "$1" == "wiki" ]]; then wikilinks=1; fi
shift
middleware='
enable_if { $_[0]->{REQUEST_URI} =~ /\.(md|mkdwn|markdown)$/ }
SimpleContentFilter => filter => sub {
#!/bin/bash
# We use --host localhost by default so that Regexp::Common matches
plackup --host 0.0.0.0 -R share,static,web "$@" 3>&1 1>&2 2>&3 \
| perl -MRegexp::Common=URI -wne 'system("gnome-open", $1), $spawned++ if not $spawned and /($RE{URI}{HTTP})/; warn $_;'
@tsibley
tsibley / gist:1237317
Created September 23, 2011 13:23
git-on-github
#!/usr/bin/env perl
use strict;
use warnings;
use Config::GitLike::Git;
my $c = Config::GitLike::Git->new;
$c->load;
my $remote = $c->get( key => 'remote.origin.url' );
@tsibley
tsibley / Nopaste.pm
Created November 14, 2012 07:58
App::Nopaste upload plugin for Shutter
#!/usr/bin/env perl
# Copyright (C) 2012 Thomas Sibley <[email protected]>
package Nopaste;
use strict;
use warnings;
use utf8;
use lib ($ENV{'SHUTTER_ROOT'} || "/usr")."/share/shutter/resources/modules";