Skip to content

Instantly share code, notes, and snippets.

@mattryall
mattryall / idea
Created November 29, 2011 07:15
Shell script to launch IDEA
#!/bin/sh
# grab the latest version of IDEA
IDEA=`ls -1dt /Applications/IntelliJ\ * | head -n1`
if [ -f "$1" ]; then # first, try any filename provided
open -a "$IDEA" "$1"
elif [ -d ".idea" ]; then # second, try the .idea directory
open -a "$IDEA" "."
elif [ -f *.ipr ]; then # third, try any IDEA project files
@mattryall
mattryall / switch.js
Created October 17, 2011 06:07
Regex fall-throughs using if/else, inspired by simplicity and clarity
[17:05] node-test$ node switch.js for the fail
fail
[17:05] node-test$ node switch.js for the lose
lose
[17:05] node-test$ node switch.js bleep blah
blah
[17:05] node-test$ node switch.js for the win
win