Skip to content

Instantly share code, notes, and snippets.

{
user => {
id => $customer_id,
username => $username,
parent_username => $parent_username
},
media => {
id => $media_id,
download_id => $download_id,
type => $media_type,
use strict;
use warnings;
use Math::Combinatorics qw(combine);
use List::Util qw(sum);
my $target = shift || 0;
my %pairs = (
#a => 1, b => 2, c => 3,
#d => 2, e => 1, f => 0,
@brianphillips
brianphillips / test-search-replace.p6
Created December 10, 2012 20:53
Testing search/replace in a loop
my $value = "/a/b/:c/d/:e";
my %values = (c => 1, d => 2, e=>3);
for %values.kv -> $k, $v {
if $value ~~ s/\:$k/$v/ {
say "Matched! $k against $value: (match was $/)";
}
}
@brianphillips
brianphillips / gist:3018235
Created June 29, 2012 14:21
dzil upgrade
$ dzil authordeps | cpanm -n
Dist::Zilla::Plugin::Authority is up to date. (1.006)
--> Working on Dist::Zilla::Plugin::AutoPrereqs
Fetching http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Dist-Zilla-4.300020.tar.gz ... OK
Configuring Dist-Zilla-4.300020 ... OK
Building Dist-Zilla-4.300020 ... OK
Successfully installed Dist-Zilla-4.300020 (upgraded from 4.300017)
--> Working on Dist::Zilla::Plugin::Git::CommitBuild
Fetching http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Dist-Zilla-Plugin-Git-1.121810.tar.gz ... OK
Configuring Dist-Zilla-Plugin-Git-1.121810 ... OK
@brianphillips
brianphillips / gist:988583
Created May 24, 2011 11:54
product configuration XSD
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by Ryan Dewell (Digital River, Inc.) -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:annotation>
<xsd:documentation>Root Elements</xsd:documentation>
</xsd:annotation>
<xsd:element name="product-configuration">
<xsd:annotation>
<xsd:documentation>Encapsulates an entire set of product configuration information.</xsd:documentation>
</xsd:annotation>
@brianphillips
brianphillips / dbd-oracle-sigint-fail.pl
Created November 2, 2010 18:22
Test killing a process with SIGINT after connecting to an Oracle database
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use POSIX ":sys_wait_h";
if(my $pid = fork){
warn "forked $pid from $$, press <ENTER> when ready to try killing\n";
my $ready = <STDIN>;
javascript:(function()%7Bvar%20d%3Ddocument%3Bvar%20PR_keywords%3Dfalse%3Bvar%20loc%3D%22http%3A%2F%2Fgoogle-code-prettify.googlecode.com%2Fsvn%2Ftrunk%2Fsrc%2Fprettify.%22%3Bvar%20h%3Dd.documentElement.getElementsByTagName(%22head%22)%5B0%5D%7C%7Cd.body%3Bvar%20style%3Dd.createElement(%22style%22)%3Bstyle.innerHTML%3D%22.perldoc%20%7B%20text-decoration%3A%20none%20%7D%5Cn%22%2B%22a%3Ahover%20%7B%20border-bottom%3A%201px%20dotted%20black%7D%20%22%3Bh.appendChild(style)%3Bvar%20g%3Dd.getElementsByTagName(%22code%22)%3Bfor(var%20i%3D0%3Bi%3Cg.length%3Bi%2B%2B)%7Bg%5Bi%5D.className%3D%22prettyprint%22%3Bif(window.location.href.indexOf(%22perl%22)%3E%3D0)%7Bg%5Bi%5D.innerHTML%3Dg%5Bi%5D.innerHTML.replace(%2F((%5BA-Z%5D%5Cw%2B%3A%3A%5BA-Z%5D%5Cw%2B)(%3A%3A%5BA-Z%5D%5Cw%2B)*)%2Fg%2C'%3Ca%20class%3D%22perldoc%22%20href%3D%22http%3A%2F%2Fsearch.cpan.org%2Fperldoc%3F%241%22%3E%241%3C%2Fa%3E')%3Bg%5Bi%5D.innerHTML%3Dg%5Bi%5D.innerHTML.replace(%2F%5E(use%7Crequire)%20(%5Cw%2B(%3A%3A%5Cw%2B)*)%2Fgm%2C'%241%20%3Ca%20class