Mailing List Archive

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

Re: [tlug] Reversing a YUI compressed file

On Mac, I think TextMate could probably handle 600k, and it's my tool of choice for formatting obfuscated source code.

Another option, I think, would be to open it in vim (which I imagine wouldn't have any serious difficulty with a 600k _javascript_ file), and then type =7j   And then there's also this, which might do better than gedit:

Not sure about any out-of-the-box command-line beautifiers, but you could try these DIY methods:

And without getting too preachy, dare I recommend using git (or svn, etc.) to avoid the problem next time?  It sounds like you're dealing with an awful lot of work to not have stashed away in a proper SCM.


On Sun, Jan 9, 2011 at 11:35 PM, Dave M G <> wrote:

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.


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

To unsubscribe from this mailing list,
please see the instructions at

The TLUG mailing list is hosted by the award-winning Internet provider
Visit ASAHI Net's English-language Web page:

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links