Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Reversing a YUI compressed file



TLUG,

Wow, I just had the most unbelievable crappy discovery today. I have a
project with a bunch of Javascript files that I have been working on for
ages. I keep it in a Dropbox folder, and also use Back In Time to back
it up. So I thought I had myself protected with sufficient back ups and
copies. Hah!

It seems that Dropbox, in it's infinite wisdom, somehow over wrote about
a month of work with previous versions of the files, sometime in the
middle of last month. I don't know how, or why, but for a variety of
reasons to long to get into here, I'm pretty sure Dropbox is the culprit.

No worries, I think, because I've got everything backed up with Back In
Time. Right? Wrong. Back In Time has a "Smart Delete" function which
keeps one version of the backup from every two weeks, every month, and
every year. The key is that last bit. Because we've just changed the
year, Back In Time removed all back ups from 2010 except for the last
one, on December 31st.

When I accepted those settings, keeping one backup from every year
sounded like a good idea, until now that I realize that if last year is
only ten days ago, you might lose some data.

Arrrrgh.

Well, not all is lost. Fortunately, I have all my code more or less
preserved in one final place. On a remote server where I test it.

Unfortunately, the Javascript code on the server has been squished down
into one 600 Kb file using YUI compressor.

Actually, all YUI compressor seems to do is take out white space and
carriage returns. So, theoretically, I could copy out all the code I
need and restore it, just with a little hassle in terms of having to
reformat it a bit.

The thing is, when I open the file in Gedit or some other text editor,
it tends to balk. I guess having everything on one long line messes with
the editors ability to parse the text. Ditto for Openoffice.

Finally... my question:

Is there a way I can modify the file from the command line to insert
line breaks and make it editable? 90% of the file is stuff I can safely
delete (YUI and JQuery code that isn't originally mine).

I think even if I were to be able to do something like insert a line
break after every "}" character that would make it parsable enough for
me to edit.

Any suggestions?

Thanks for any tips.

-- 
Dave M G



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links