Posts filed under 'downloadable'

Scraping Source in Safari

Here is an applescript solution for grabbing the html code from a page online. This is particularly handy if you are trying to grab the code from a page that you need to login to. I am sure there is a much better solution out there, but this one seems to work for me ok.

CODE:
  1. -- Define the page to save the document and the url
  2. set the pageFile to "/Users/yourUserNameHere/Desktop/safariSource.html"
  3. set the pageUrl to "http://www.plasticstare.com/"
  4.  
  5. -- define the applescript to run
  6.  
  7. tell application "Safari"
  8.    activate
  9.    make new document at end of documents
  10.    set URL of document 1 to pageUrl
  11. end tell
  12.  
  13. set web_page_is_loaded to false
  14. --check if page has loaded
  15. repeat
  16.    delay 0.5
  17.    tell application "System Events" to tell application process "Safari"
  18.       if (name of static text 1 of group 1 of window 1 as text) begins with "Contacting" or (name of static text 1 of group 1 of window 1 as text) begins with "Loading" then
  19.          -- do nothing
  20.       else
  21.          exit repeat
  22.       end if
  23.    end tell
  24. end repeat
  25.  
  26. tell application "Safari"
  27.    set siteSource to the source of document 1 as text
  28.    set theFile to open for access (pageFile) as POSIX file with write permission
  29.    set eof of theFile to 0
  30.    write siteSource to theFile
  31.    close access theFile
  32. end tell

Add comment Sun, 2008 Mar 30, 6:19pm

Delicious for Wordpress

Props to Rick for this simple way for adding recent delicious bookmark postings to your wordpress sidebar. Download Delicious for Wordpress here: http://rick.jinlabs.com/code/delicious/

It was the simplest way I could find to do this. It isn't customizable, other than editing the code yourself, but it does a great job out of the box, and does pretty much what you would want it to do anyway, which is post things to your blog that you found interesting, without having to actually write a post about it...hooray for industrious laziness!

Add comment Sun, 2008 Mar 30, 4:50pm

Applescript Show Track in Finder

Space has been tight lately on my laptop and I've been too lazy to thoroughly go through and clean up. I keep regular backups, however, so I wrote this script so that when I hear a track that I don't care so much about in iTunes on random, I can go to the folder and kill the track or the album, or heck, all tracks by that artist, quickly. You can put this file in your iTunes scripts folder and trigger it from Quicksilver as well for easy access.

PlasticWare Downloadable ::
Show Track in Finder (Mar. 11, 2008)
Download (~3,146 bytes) :: ShowTrackInFinder.zip

Add comment Tue, 2008 Mar 11, 1:44pm

As2Api and RubyScript2Exe (darwinized)

I recently sat down and took a look at as2api, which seems to be the most recommended JavaDoc exporter for actionscript. Once I had everything figured out, it seems to work fine, and I'm sure there are some little nuggets that I haven't quite figured out yet, which I'm looking forward to figuring out. (read more for the skinny and darwin downloads)

However, for those of you out there in Mac OSX land, I wouldn't recommend downloading the current version listed on the site for OSX, entitled "as2api-allinone-osx-0.4.sit" in the downloads section. I think that it is missing files, or that it just doesn't work correctly at all. I would recommend instead downloading the first link for "as2api-0.4.tar". The downside of downloading this version is that there is no OSX command line executable in there, so you have to run the Ruby script "ruby as2api.rb packages --classpath classpath" which works just fine.

Honestly, I don't know enough about ANT scripts yet to know if you can run Ruby scripts from an ANT script target, so I used rubyscript2exe, another handy little application to convert the Ruby scripts into a mac command line executable. (Incidentally, and to add a little geek comedy to this post, you have to install the Pascal compiler and compile a piece of the rubyscript2exe library in order to run it...so I had to compile one application in order to create another one...).

Anyway, I have included below 2 downloadables in this post. The first is the command line version of as2api that is compiled from the package that you can download as Ruby code from the as2api site. The down side is that you cannot tweek the css and html templates that are part of that code; the up side is that you can actually use it as a command line executable, which is entitled "as2api_darwin". You can used it exactly as you would the as2api.rb Ruby script.

PlasticWare Downloadable ::
Darwin Executable of As2Api (JavaDoc for Actionscript) (Sep. 5, 2006)
Download (~4.5mB) :: as2api-0.4.zip

The second downloadable I have included here is the rubyscript2exe download, altered to include the eee_darwin file that I compiled from the pascal source on my mactel laptop in OSX 10.4.7, and repackaged using tar2rubyscript.rb, which was also necessary to get it running properly. I have also included the example hello world script "hello.rb" from the tutorial, which you can use to test the code and make a hello world exe.

PlasticWare Downloadable ::
RubyScript2Exe with eee_darwin for OSX environment (Sep. 5, 2006)
Download (~1.1mB) :: rubyscript2exe.zip.gz

Both of these pieces of software are released by their proper creators under the GNU License, and I have included the source and license for each as well, as posted on their sites. Please download judiciously, the executable for as2api package is 4.5 mb.

7 comments Tue, 2006 Sep 05, 5:55pm

Textmate (Revisited) vs. TextWrangler

PlasticWare Downloadable ::
PlasticCodeWrap TextMate Syntax Theme Version 1.0 (Jul. 18, 2006)
Download (~1400 bytes) :: PlasticCodeWrap.zip

So, now that I have moved on to working for a software company, I've moved on also to actually coding more javascript for work. For some quick and dirty (well, actually not so dirty, but outside the realm of a set up project environment in Eclipse) javascript coding, I decided to give a couple of old favorites another look-see. I opted to run some tests with TextWrangler, the freeware barebones.com software offering in leiu of BBEdit, and with TextMate from macromates.com.

In the past and recent past in fact, I've opted to use TextWrangler for many tasks that I couldn't find a way to do otherwise. Both BBEdit and TextWrangler have superior capabilities in single and multi-file grep searches for some seriously powerful search and replace functionality, and some other really nice features that are pretty handy for the code junkie. The multi-file search allows you to search any folder of files that your computer can access, while TextMate I believe only supports searching all files in a "project." You can also use any BBEdit plug-ins for TextWrangler, although there aren't that many out there these days that I haven't been able to live without. From an appearance standpoint, the interface is clean and easy to use, albeit somewhat limited in the way that one can customize it.

Textmate, while I have read some not-so-glowing reviews about its search capabilities (I know, I'm sorry, but I really dig BBEdit/TextWrangler for searches) and diff functionality, I have to say that from an interface standpoint, its just much more comfortable to use. There are a few wonky things (such as the fact that the setting for tab stops is at the bottom of the window in a drop down), but the total gui package is just more a pleasure to use. In addition, I like the scheme for syntax coloring in TextMate better. Its more intuitive and extensible to the mid-level user, and there are already quite a few syntax "themes" out there (none of which I absolutely loved, but more on that later). TextMate also features easy to use macro editing and the "Bundle Editor" which allows the user to go crazy adding code snippets and macros to the already extensive set of "bundles" that support every code language I've ever wanted to use, with the ability also to integrate these macros with shell scripting.

SO, I have to say, I'm sticking with TextMate again, although I will undoubtedly use TextWrangler for search and replace functions at some point. TextMate's ability to let the user build code snippets (that are accessible using short key combinations with the TAB key) and nice syntax coloring features did it for me. Strangely enough, both are pretty code junkie friendly, but both default to black text on white background. There are several syntax themes out there for both (see UserSubmittedThemes at the macromates wiki). I didn't absolutely love any of the ones I found, so I used the theme in TextMate called "Slate" and munged (Mason's favorite word) it together with Ruby Blue, Blackboard, and Mac Classic (which is white background as well). Its called PlasticCodeWrap and it can be downloaded above.

Add comment Tue, 2006 Jul 18, 11:31am


Site Decryption

info = { PlaIns: "the section of the PlasticStare site, the digital external brain-repository of Ryan Todd, whose brain otherwise occupies space in San Francisco, CA", ryota: "mungified version of ryan's name", haikuBio: "robotic from birth. hears sounds - listens to music. makes pixels act." }

Calendar

July 2008
S M T W T F S
« Jun    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Posts by Month

Posts by Category