Skip to content

Instantly share code, notes, and snippets.

View rjattrill's full-sized avatar

Ross Attrill rjattrill

View GitHub Profile
@rjattrill
rjattrill / SetTabStyle.mxml
Created May 23, 2012 00:58
Setting Tab Styles and Colours - Tab Navigator
<fx:Script>
<![CDATA[
import mx.controls.Button;
[Embed(source='/assets/small_tick.png')]
[Bindable]
public var imgTick:Class;
private function setTabColours(index:int):void {
@rjattrill
rjattrill / Sleep.vba
Created May 23, 2012 02:24
Sleep in VBA
Sub Setting_Sleep_Without_Sleep_Function()
Debug.Print Now
Application.Wait DateAdd("s", 10, Now)
Debug.Print Now
@rjattrill
rjattrill / DBIDM_last_insert_id_MSSQL.pl
Created June 4, 2012 05:40
Getting last_insert_id with MSSQL and DBIx::DataModel
use Moose;
use DBIx::DataModel;
use DBI;
our $dbh;
our $schema;
sub BUILD {
$dbh = get_dbh();
my %dbh_options;
@rjattrill
rjattrill / CreateSchemaDbidm.pl
Created June 13, 2012 06:01
Create Schema from Database with DBIx::DataModel
use Modern::Perl;
use DBIx::DataModel;
use DBIx::DataModel::Schema::Generator qw(fromDBI);
use FindBin qw($Bin);
my $schema = 'Scratch';
my $schema_name = $schema . "::Schema";
my $generator = DBIx::DataModel::Schema::Generator->new(-schema => $schema_name);
@rjattrill
rjattrill / InsertDbidm.pl
Created June 13, 2012 06:02
Insert row - DBIx::DataModel
use strict;
use warnings;
use DBI;
use DBIx::DataModel;
use DateTime;
use Try::Tiny;
use Test::More;
@rjattrill
rjattrill / DateTimeString_MSSQL.pl
Created June 15, 2012 00:38
DateTime String in Format Suitable for MSSQL
use DateTime;
my $dts = DateTime->now->strftime('%F %T');
@rjattrill
rjattrill / DataGridHeaderWrap.mxml
Created July 5, 2012 00:01
Word Wrap in Spark DataGrid Header
<?xml version="1.0"?>
<s:Group
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="200" height="100"
>
<s:DataGrid id="dataGrid" width="100%" height="100%" minHeight="100" variableRowHeight="true"
>
@rjattrill
rjattrill / TestPort.ps1
Created July 6, 2012 01:56
Test if a port is open using powershell
1443 | % { echo ((new-object Net.Sockets.TcpClient).Connect("192.168.75.11",$_)) "server listening on TCP port $ _" }
@rjattrill
rjattrill / DataGridDateFormat.mxml
Last active October 7, 2015 02:58
Format Date in DataGrid
<fx:Declarations>
<s:DateTimeFormatter id="dateTimeFormatter" dateTimePattern="yyyy-MM-dd"/>
</fx:Declarations>
<s:DataGrid id="dg" height="100%" width="100%" borderVisible="false">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="Date" headerText="Date" formatter="{dateTimeFormatter}"/>
</s:ArrayList>
</s:columns>
@rjattrill
rjattrill / RefreshFlashObject.as
Created August 7, 2012 03:55
Refresh Flash Object using F5
// Allow F5 to reload the browser window including the SWF object itself.
// Thank you Jake Howlett: http://www.codestore.net/store.nsf/unid/BLOG-20091027-0543
private function init():void {
FlexGlobals.topLevelApplication.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
}
private function keyHandler(event:KeyboardEvent):void {
if (event.keyCode==116)
ExternalInterface.call("window.location.reload");