Skip to content

Instantly share code, notes, and snippets.

View theory's full-sized avatar
💭
🥃

David E. Wheeler theory

💭
🥃
View GitHub Profile
# Git function from http://github.com/bkerley/zshkit/raw/master/06_git.
autoload -Uz colors
colors
if [[ -x `which git` ]]; then
function git-prompt() {
gstatus=$(git status 2> /dev/null)
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
if [[ x$branch != x ]]; then
dirty_color=$fg[cyan]
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,
group_concat( phillipadsmith_bricbugs.longdescs.thetext SEPARATOR '--~~--')
FROM phillipadsmith_bricbugs.bugs
INNER JOIN phillipadsmith_bricbugs.longdescs
ON phillipadsmith_bricbugs.bugs.bug_id = phillipadsmith_bricbugs.longdescs.bug_id
GROUP BY phillipadsmith_bricbugs.bugs.bug_id
<%args>
$asset => $story
</%args>
<%init>;
# Get the month and year.
my $month = $asset->get_cover_date("%m");
my $year = $asset->get_cover_date("%Y");
# Construct the date for the first of the month.
my $start = "$year-$month-01 00:00:00";
my @last_days = (
undef,
sub { 31 },
sub { my $y = shift; return $y % 4 or not ($y % 100) 28 : 29 },
sub { 31 },
sub { 30 },
sub { 31 },
sub { 30 },
sub { 31 },
sub { 31 },
% pg_prove -d corp tests/*.sql
tests/fixtures.sql .................................. ok
tests/mls_agents.sql ................................ ok
tests/mls_count.sql ................................. ok
tests/mls_listings.sql .............................. ok
tests/mls_offices.sql ............................... ok
tests/schemas.sql ................................... ok
tests/tiger_client_list.sql ......................... ok
tests/tiger_domain_active_mls_areas.sql ............. ok
tests/tiger_domain_active_mls_boards_mls_types.sql .. ok
module ActiveRecord
class Base
class ConnectionSpecification #:nodoc:
class << self
alias_method :orig_establish_connection, :establish_connection
def establish_connection(spec = nil)
orig_establish_connection(spec)
puts "Hello"
end
end
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
alias_method :originit, :initialize
def initialize(connection, logger, connection_parameters, config)
ret = originit(connection, logger, connection_parameters, config)
self.execute('SELECT prepare_perl_utils()')
return ret
end
end
my $parse_datetime = sub {
my $ts = shift or return undef;
return eval { DateTime::Format::W3CDTF->parse_datetime($ts) }
|| eval { DateTime::Format::ISO8601->parse_datetime($ts) }
|| eval { DateTime::Format::Flexible->parse_datetime($ts) }
|| do {
my $p = DateTime::Format::Natural->new;
my $dt = $p->parse_datetime($ts);
$p->success ? $dt : undef;
};
# Failed test 'Feed modified PubDate should be correct'
# at t/17-loose-dates.t line 50.
# got: '2010-05-19T14:56:00'
# expected: '1010-05-19T14:56:00'
# got utc_rd_values: 733911, 68160, 0
# expected utc_rd_values: 368668, 68160, 0
// N.B.: May require a `LICENSE` file if the `license` key is missing or has an unknown value.
// The string should map to a known URL, or else allow an explicit mapping:
"license": {
"perl5": {
name: "The Perl License",
uri: "http://..."
}
}