This is a presentation designed for the August 16, 2012 meeting of the Baltimore Perl Mongers. It is not quite an introduction to the idea of git (as many of the members are already aquainted with it to some degree), but a discussion of some of the more interesting features that can be folded into a workflow quickly and
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# commands that are too long to reasonably be represented | |
$_gwt = "git tag | grep -e '^release-[0-9]\\{1,\\}\$'" | |
$_gwl = "${_gwt} | cut -d\\- -f2 | sort -rn | head -n1" | |
# figure out how to deploy this project | |
case "$mode" { | |
# ... | |
# prod box, make sure the latest code is loaded | |
'production': { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# do regular system bashrc stuff, if there's one set up | |
if [ -f /etc/bashrc ] ; then | |
. /etc/bashrc | |
fi | |
# use 256 colors if available, otherwise default to | |
if [ -f /usr/share/terminfo/x/xterm-256color ] ; then | |
export TERM=xterm-256color | |
else | |
export TERM=xterm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package POE::Component::dns::monitor::sniffer; | |
use POE; | |
use warnings; | |
use strict; | |
sub spawn { | |
my ($session) = POE::Session->create( | |
inline_states => { | |
_start => sub { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.14; | |
use warnings; | |
use perl5i::2; | |
[0 .. 5]->foreach(func($i) { | |
say "current value of i is $i" | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# etc. etc. etc......... | |
unless request.user_agent =~ /AppleWebKit/ | |
# sub out all diagram corners with ascii + | |
%w(┌ ┐ └ ┘).each do |corner| | |
data.gsub!(corner, '+') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- you may have to declare the function after the table exists. | |
CREATE FUNCTION check_unique_ex(TEXT, TEXT, TEXT) | |
RETURNS BOOLEAN | |
LANGUAGE SQL | |
AS $BODY$ | |
SELECT EXISTS ( | |
SELECT 1 | |
FROM ex | |
WHERE a IS NOT DISTINCT FROM $1 AND | |
b IS NOT DISTINCT FROM $2 AND |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE | |
FUNCTION MYAVG(VARIADIC NUMERIC[]) | |
RETURNS NUMERIC | |
LANGUAGE SQL | |
AS 'SELECT AVG(unnest) FROM UNNEST($1)'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
use strict; | |
my ($home, $psql, $pg_ctl, $pg_dump, $code_root, $mig_dir, $replication, | |
$localdb, $rvm, $rubyver, $gemset_name, $gemset, $ruby_bin, $padrino, | |
$rep_port, $local_port); | |
my ($SUPER, $OWNER, $PRODDB, $DEVDB, $TESTDB, $TESTTMPLDB); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set up the database connections and other libraries | |
*/ | |
require( | |
join(DIRECTORY_SEPARATOR, | |
array(dirname(__FILE__), '..', '..', 'pg_connect.php')) | |
); |