Display emoji faces for correct & wrong commands in terminals
Building on Maghin's post. 

# Use echo -n to leave out the line end.
# Use -C option with hexdump to avoid big endian/little 
# endian confusion.
mac $  echo -n  | hexdump -C
00000000  f0 9f 98 80                                       |....|
00000004
mac $  echo -n   | hexdump -C
00000000  f0 9f 98 b1                                       |....|
00000004


"Include non-0 exit codes in the subsequent bash prompt"
http://stackoverflow.com/questions/5946873/include-non-0-exit-codes-in-the-subsequent-bash-prompt

Here is what I ended up with:

export PS1='\u $(highlightExitCode) \$ '


highlightExitCode()
    {
        exit_code=$?
        if [ $exit_code -ne 0 ]
        then
           echo -en '\xf0\x9f\x98\xb1 '
        else
           echo -en '\xf0\x9f\x98\x80 '
        fi

    }




A more straight forward alternative for the highlightExitCode function:

 highlightExitCode ()  { 
   if [ $? -ne 0 ]; then
     echo -n ' ';
   else
     echo -n ' ';
   fi 
 }


The only problem is that the bad image appears until to you run a succesful command.