TextMate ActionScript 3 and Flex Bundles
October 30th, 2007
As a Flash developer who’s been working with Flex and ActionScript 3 since late last year I found I couldn’t settle down and use the Flex Builder Eclipse plug-in. Previously I had acquired the habit of editing ActionScript using TextMate and compiled using the lightning fast MTASC, and although there were alternatives (FDT, Sepy), I’ve always preferred the lightweight flexibility and crisp feel that TextMate has. As a result I’m responsible for TextMate’s ActionScript 3 and Flex bundles.
At the moment the bundles are in the review section of the TextMate Repository. Once installed the bundle help covers how to set up (primarily to download the flex sdk) and outlines the non-obvious commands.
The main highlights of the bundles are:
- MXMLC and FCSH Build Commands.
- Function, Tag, Import Auto Completion.
- ActionScript 3 and Flex documentation search.
- Drag and Drop of imports, includes, embed assets, css, xml.
- ASDoc Support.
- MXML Validation.
- Manifest Generation.
- Class and Component Templates.
- Flex Builder compatible project creation.
- Unused Import statement removal.
- Shortcut Key Super Class, Code Behind and Import file opening.
Thanks to the following people who have all had a hand, although they may not know it, in the creation of the bundles:
- Daniel Parnell
- Theo Hultberg
- Mark Llobrera
- Joachim
- ChromaticRain
- Thomas Aylott
For those of you who don’t use subversion the following zip’s can be downloaded, but they won’t necessarily be the latest version :
Using svnX via svn-ssh
February 5th, 2007
This is a relatively simple thing to do, and it’s really all about setting up shh rather than svn, but when you don’t quite understand what is happening it’s a little creepy having the authentication handled automatically. The shh authentication process uses a public / private key system which is explained nicely here.
To start you need ssh to use keys rather than passwords. This is because subversion needs to “transparently” authenticate each time you make a request. I hope I’m right in thinking that it opens a tunnel to the remote machine and invokes the service as a svnserve process there.
So, open a terminal window and type ssh-keygen -d to generate your public and private ssh keys. Hit return at each prompt to stick with the default options. You’ll end up with two files called iddsa.pub and iddsa in your pwd move the files to ~/.ssh/. Then you need to copy the contents of iddsa.pub to this file ~/.ssh/authorizedkeys on your remote machine ( the one hosting the subversion repository) – creating it if it doesn’t exist. You can append more than one public key to the authorizedkeys file if you’re connecting from more than one machine. If you have access to more than one user account on the the remote machine then you need to copy the key into each users authorizedkeys file. I used CyberDuck along with a sftp connection to get the onto the remote machine. You should then be able to login to the remote machine using username@server.org.
Once you’ve got the ssh connection verified it should be plain sailing with svnx. You’ll be able ot use your repository with the following
svn+ssh://username@domain.com/path/to/repository
I’ve just found this on the TextMate blog. It’s covering the same ssh key generation process, but using the command line completely, and describing how to set up ssh aliases to save a little bit of typing.
svn ignore
January 20th, 2007
How do you get subversion to ingnore certain files? It can be done globally or on a per directory basis.
For global ignores find your subversion config file. For me this was here ~/.subversion/config then edit the following line, here I’ve added *.tmproj to ignore any file which ends with .tmproj (the * being a reg exp for any prefix).
global-ignores = .o *.lo *.la ## .*.rej *.tmproj
To ingnore files on a per directory basis cd to the directory in question and use the following.
svn propset svn:ignore "*.cache" .
This will apply the ignore to the file or files specifed by the pattern. In this case all files ending with .cache. The trialing . applies the ignore to the current directory, but can be the path to any subversion directory. The command above creates a .svn/dir-props file with the following contents in the specified directory.
K 10
svn:ignore
V 8
*.cache
END
Keychain Access from a Shell.sh Script
January 17th, 2007
Here’s a useful snippet to enable you to securely store passwords in OS X’s keychain and use them in a shell scripts.
#!/bin/bash PASSWORD=`exec osascript <<EOF | tr "\r" "\n" (* To use the Keychain to store the admin password then Open /Applications/Utilities/Keychain Access.app Add a new keychain called "TM" Add a Key with the name "test" and store your password in it. I'd recommend learning how keychains work then tailoring the process to your security needs. *) EOF` echo "$PASSWORD" exit 0;
Update: As of Leopard it is now possible to do this via the command line tool security
That Dictionary File,
January 11th, 2007
the one i’m always forgetting where it hides, with the 234,936 english words in, is here
/usr/share/dict/web2
as the readme says “it makes a dandy ‘grep’ vicitim”. Want a random word?
perl -e 'rand($.) < 1 && ($line = $_) while <>; print $line' \
/usr/share/dict/web2
Change “Welcome to Darwin!”
January 11th, 2007
Here’s how to change the “Welcome to Darwin!” message when you open a new terminal. Simply open:
/etc/motd
and change the contents to whatever you like. I favour “Welcome to Hell!”
Update: As of Leopard you may find that the motd (Message of the Day) file no longer exists. If this is the case then you just need to create it. The contents will then be displayed each time you open a new Terminal window.
Switching flash players on OS X
January 8th, 2006
I wrote the following shell script a while back for use with TextMate as part of my build process. TextMate’s great as it easily allows you to bind scripts to custom commands (and key combinations). However you’d easily be able to adapt it to your set up. It will allow you to cleanly change all the flash players available for OS X, as well as being able to Uninstall the player, and optionally restart open browsers (FireFox and Safari) afterwards.
You’ll need to download the players, install and move the files into archived folders the contents of which the script will copy to the default internet plug-ins folder. It shouldn’t be too difficult to work out how this happens and alter the script for your needs.
Download the script here
To install the FP 7.0.14 without restarting any open broswers:
changePlayer.sh 7.0.14 false
To uninstall the flash player:
changePlayer.sh uninstallflashplayer
To install FP 6.0.49, restarting open browsers:
changePlayer.sh 6.0.49
If there’s anyone out there using TextMate and would like a the above wrapped up in a bundle then please email me and I’ll send a copy over.
Recursively remove .svn files
December 16th, 2005
Here’s a quick shell script to recursively remove all the the .svn files starting in the current directory and working down.
find . -type f -name "*.svn" -exec rm '{}' \; -print
Change .svn to look for different types.
Shell to Clipboard
December 13th, 2005
I figured it’d be nice to be able to print output from the terminal/shell to OS X’s general clipboard. So after a little digging I found these two commands:
pbcopy – copy to the clipboard. pbpaste – paste from the clipboard.
Piping output should come in handy, ie:
pwd | pbcopy
will print the full path of the current directory directly to the cliboard. Or :
ls | pbcopy
for a list on the contents of the current directory.
Found over at Ted’s Ted’s Macintosh Tips and Tricks, which is well worth a butchers.
By eck.
December 13th, 2005
Suprise. Suprise. I completely forgot about setting this up… It’s bound to go in fits and starts. The plan is to start posting techy tips and tricks I come across in an effort to collect them in once place. They’ll be covering flash, os x, terminal etc. Ohh and to try and build a collection of inspiring sites I find. Let’s see if I mange that…

