Skip to content

Instantly share code, notes, and snippets.

View rjattrill's full-sized avatar

Ross Attrill rjattrill

View GitHub Profile
@rjattrill
rjattrill / BrowserSize
Created December 2, 2013 23:28
Find current browser size
Put this in the address bar:
http://whatsmy.browsersize.com/
@rjattrill
rjattrill / SparkFormLayoutGap.mxml
Last active December 29, 2015 05:29
Reduce vertical gap in Spark Form layout
<s:Form>
<s:layout>
<s:FormLayout gap="-5"/>
</s:layout>
</s:Form>
@rjattrill
rjattrill / TaskTemplateDocumentSend.mxml
Last active November 14, 2019 11:25
Bind a Flex component to two conditions using && in MXML
<s:Button id="sendBtn" label="Send" click="sendBtn_clickHandler(event)"
enabled="{!model.documentSending &amp;&amp; model.documentCreated}"/>
@rjattrill
rjattrill / multiline-values.yaml
Created November 18, 2013 06:33
Break YAML over multiple lines
# Join multiple lines without new line
value: >
part 1
part 2
# Join with newline
value2: |
line 1
line 2
@rjattrill
rjattrill / SortArrayCollection.as
Last active December 28, 2015 07:09
Sort a Flex ArrayCollection. Note, to programmatically sort values in a Spark DataGrid, one way is to sort the dataProvider - which is usually an ArrayCollection. (Another way is to use the sortbyColumns() method on some event.)
var dataSortField:SortField = new SortField();
dataSortField.name = "activity";
dataSortField.numeric = false;
var sort:Sort = new Sort();
sort.fields = [dataSortField];
this.taskAc.sort;
this.taskAc.refresh();
@rjattrill
rjattrill / CopyArrayCollection.as
Created September 10, 2013 04:39
Copy an ArrayCollection in Flex
// ArrayCollection variables are references, so to create a copy:
var copyAc:ArrayCollection = new ArrayCollection(sourceAc.toArray());
// or
var copyAc:ArrayCollection = ObjectUtil.copy(sourceAc) as ArrayCollection;
use strict;
use warnings;
use v5.10;
use Test::More;
use Try::Tiny;
use Data::Dumper;
use Carp;
use List::Util qw(first);
use Class::Inspector;
@rjattrill
rjattrill / DynamicClassNameTest.t
Created July 9, 2013 06:40
Data::Dump - warning on dynamic class with '=' in name Can't handle >Table2|t2=HASH data at c:/opt/strawberry/perl/vendor/lib/Data/Dump.pm line 377.
use Test::Most;
use v5.10;
use Data::Dumper;
use Data::Dump qw(dump);
my $dynamic_name = 'Table1|t1<=>Table2|t2';
package Bar {
sub new {
my $class = shift;
@rjattrill
rjattrill / read_data_structure.pl
Created June 5, 2013 03:01
Read a data structure in __DATA__ back into a variable.
use strict;
use warnings;
use v5.10;
use Data::Dump qw(dump);
my $var;
while (<DATA>) {
$var .= $_;
}

Abstract

DBIx::DataModel (DBIDM) is a light and powerful framework that simplifies interactions with relational databases. DBIDM makes simple database interactions easy and complex interactions possible - all using Perl.

In February I described three key advantages of DBIDM and in this article I will describe three more being:

  • a small but discerning list of CPAN dependencies
  • more efficient than raw SQL for joins
  • a design philosophy that 'less is more' - bringing out the strengths of Perl and DBI