Skip to content

Instantly share code, notes, and snippets.

View jasonm23's full-sized avatar

Jason Milkins jasonm23

View GitHub Profile
@jasonm23
jasonm23 / gist:373562
Created April 21, 2010 07:56
Singleton pattern
package ${packagename}
{
class ${Singleton}
{
private static var _instance:${Singleton};
public function ${Singleton}(enforcer:SingletonEnforcer)
{
@jasonm23
jasonm23 / aliases.sh
Created April 21, 2010 08:23
collection of useful shell aliases.
# collection of useful shell aliases.
alias ll='ls -halFG'
alias l='ls -1aG'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias p='pwd'
alias findr='find . -regex'
alias findir='find . -iregex'
alias findn='find . -name'
@jasonm23
jasonm23 / gist:373711
Created April 21, 2010 11:17
cycle through cmdline opts
#!/bin/bash
until [ $# -eq 0 ]
do
echo parameter: $# value: $1
shift
done
@jasonm23
jasonm23 / SockPost
Created April 23, 2010 02:20
grep =#HEXRGB, =\#HEXRGB or =0,0,0..=255,255,255 (rgb values)
# grep =#HEXRGB, =\#HEXRGB or =0,0,0..=255,255,255 (rgb values) from a simple 'key=value' file.
# e.g. Java # properties. (Eclipse .prefs, windows .ini)
cat file.prefs | grep -E -i -e '=\#([0-9|A-F]){6}|=\\\#[0-9|A-F]|=([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(,([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){2}[^ ,0-9]';
@jasonm23
jasonm23 / gist:381441
Created April 27, 2010 22:40
AS3/Flex StringUtil.substitute
StringUtil.substitute("ClassName [name={0}, key={1}, field={2}, etc={3}]", name, key, field, etc);
/*
StringUtil.substitute is a useful print formatter tucked away in the Flex SDK, if you're used to printf in C or String.format() in C# you'll be glad to find this
Whatever the case, rolling a complex string in AS3 is much easier with this than the alternative.
e.g.
"ClassName [name=" + name + ", key=" + key + ", field=" + field + ", etc=" + etc + "]";
@jasonm23
jasonm23 / RemoveDuplicates.mxml
Created April 29, 2010 08:34
Remove duplicate items from an array
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init()">
<mx:Script>
<![CDATA[
private var keys:Object = {};
/**
* Called by the Application container's creationComplete
@jasonm23
jasonm23 / ArrayDiff.as
Created April 30, 2010 10:12
ArrayDiff compares two arrays and provides added, matched & removed arrays.
package
{
/**
* ArrayDiff compares two arrays comparison & master, and
* produces 3 arrays:
*
* matched array is a collection of items that are present
* in both arrays.
*
@jasonm23
jasonm23 / Embed types for AS3 & Flex
Created May 5, 2010 21:16
Embed types for AS3 & Flex
// Embed types for AS3 & Flex
/*
Note, mxmlc recognizes your src folder "Default Package" as '/' (root) when using:
[Embed], source="@Embed('')" or @font-face tags.
For example... if your assets folder is a sibling of the src folder, you access using
the slightly odd path:
@jasonm23
jasonm23 / ExportAIFoldertoPNGFolder.jsx
Created May 5, 2010 22:37
Export folder of AI's to PNG (choose input/output folder)
/**
* Illustrator script.
* Export folder of AI's to PNG (choose input/output folder)
*
*
* @author Jason Milkins - mentalaxis.com
*/
var folder = Folder.selectDialog('Select folder with illustrator files...');
var pngFolder = Folder.selectDialog('Select folder for png export...');
@jasonm23
jasonm23 / gist:394441
Created May 8, 2010 08:05
External AS3 libs (refs only)
Here's the links to the 3rd party source code
MySQL libs
Home Page: http://asql.mooska.pl/
Version Used:
Package: com.hillelcoren.*
Comments: We may want to deprecate this lib for ASSQL http://code.google.com/p/assql/ in the near future until a move to the cloud
AdvancedAutoComplete
Home Page: http://hillelcoren.com/flex-autocomplete/
Version Used:
Package: com.hillelcoren.*