Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Milkins jasonm23

View GitHub Profile
@jasonm23
jasonm23 / gist:373562
Created Apr 21, 2010
Singleton pattern
View gist:373562
package ${packagename}
{
class ${Singleton}
{
private static var _instance:${Singleton};
public function ${Singleton}(enforcer:SingletonEnforcer)
{
@jasonm23
jasonm23 / aliases.sh
Created Apr 21, 2010
collection of useful shell aliases.
View aliases.sh
# 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 Apr 21, 2010
cycle through cmdline opts
View gist:373711
#!/bin/bash
until [ $# -eq 0 ]
do
echo parameter: $# value: $1
shift
done
@jasonm23
jasonm23 / SockPost
Created Apr 23, 2010
grep =#HEXRGB, =\#HEXRGB or =0,0,0..=255,255,255 (rgb values)
View SockPost
# 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 Apr 27, 2010
AS3/Flex StringUtil.substitute
View gist:381441
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 Apr 29, 2010
Remove duplicate items from an array
View RemoveDuplicates.mxml
<?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 Apr 30, 2010
ArrayDiff compares two arrays and provides added, matched & removed arrays.
View ArrayDiff.as
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
Embed types for AS3 & Flex
View 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
Export folder of AI's to PNG (choose input/output folder)
View ExportAIFoldertoPNGFolder.jsx
/**
* 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
External AS3 libs (refs only)
View gist:394441
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.*