Apple SVN oops

Posted by crayz

One of Apple's pages, right now:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<<<<<<< .mine
    <title></title>
    <meta http-equiv=refresh content="1; URL=/ipod/nike/">
=======
    <title>Apple</title>

    <meta http-equiv=refresh content="1; URL=/ipod/nike/">
>>>>>>> .r7535
    <script language="JavaScript" type="text/javascript" charset="utf-8">
    <!--
        function time() {
            setTimeout("window.location.replace('')",1)
        }
    // -->
    </script>
</head>
<body onload="time()">
</body>
</html>

OS X Ruby Alarm Clock

Posted by crayz

No real error checking, but it should be pretty obvious whether it works when you run it.

%w(rubygems rbosa chronic).each{ |dep| require dep }

itunes = OSA.app 'iTunes'
wake_at = Chronic.parse ARGV.first
time_until_alarm = wake_at - Time.now

puts "I'll wake you up at #{wake_at}"
sleep time_until_alarm

itunes.play

Leopard loves Ruby

Posted by crayz

The following uses ruby-growl and Apple's RubyOSA (think AppleScript for Ruby) to connect to iTunes and push the current track(if there is one) to its end, and pop-up a nice notification that it did. It's a slightly silly use, but I've always wanted a quick way to skip to the end of the current song while still bumping it's playcount(just hitting "next track" in iTunes won't increment your playcount of the current one, even though you just listened to 75% of it)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
GROWL_PASS = "zzzzz"

require 'rubygems'
require 'rbosa'
require 'ruby-growl'

def growl_notify(message)
  growl = Growl.new "localhost", "ruby-growl", ["itunes-ruby"], nil, GROWL_PASS
  growl.notify "itunes-ruby", "iTunes / ruby", message
end

itunes = OSA.app('iTunes')
if(current_track = itunes.current_track.get rescue false)
  track_name = current_track.name
  itunes.player_position = current_track.finish
  growl_notify "track '#{track_name}' ended"
else
  growl_notify "no track currently playing"
end

(sorry about the fugly syntax hilighting)

Apple vs. Microsoft

Posted by crayz

From a Slashdot comment, the funniest thing I've seen all week. All you need to know about the difference between Apple and Microsoft:

Steve Jobs, introducing Mac OS 1.0:

Steve Ballmer, introducing Windows 1.0:

Update: There's been a lot of debate at work on whether the Ballmer ad is a parody. It certainly does seem like a parody, but I can't find anything online that definitely says it is. Whereas I did find this official copy of a speech by Ballmer where he says:

I feel a little bit, honestly, like when we did the launch of the original Windows 1.0.There's just so much, and I remember doing videotape where I said, you know, "We've got this and that and this and that and this and that and this and that and even more! We've got Reversi!"

The controversy continues...