Recently in Toys Category

Sometimes something (I suspect iSync) screws up and duplicates my tasks. This has proven useful:

tell application "OmniFocus"
  tell first document
    repeat with aContext in contexts
      set toDelete to {}
      set seen to {}
      repeat with aTask in tasks of aContext
        if seen contains name of aTask then
          set end of toDelete to id of aTask
        else
          set end of seen to name of aTask
        end if
      end repeat

      repeat with aTask in toDelete
        try
          delete (task id aTask)
        end try
      end repeat
      count of toDelete
    end repeat
  end tell
end tell

This adds uniform search across blogdigger, yahoo, and google. findory is dead. feedster and daypop simply suck and weren't worth all the timeouts.

tell application "NetNewsWire"
  activate
  set search_terms to {"%22Eric+Hodel%22", "%22Ryan+Davis%22", "ImageScience", "ParseTree", "RubyInline", "ZenHacks", "autotest", "image_science", "ruby+heckle", "ruby+obfuscator", "ruby2c", "vlad+ruby", "zenspider", "zentest"}
  repeat with search_term in search_terms
    set the_url to "http://www.blogdigger.com/rss.jsp?queryString=" & search_term & "&sortby=date&days=20"
    subscribe to the_url

    set the_url to "http://news.search.yahoo.com/news/rss?p=" & search_term
    subscribe to the_url

    set the_url to "http://blogsearch.google.com/blogsearch_feeds?hl=en&tab=wb&q=" & search_term & "&ie=utf-8&num=10&output=rss"
    subscribe to the_url

    -- dead
    -- set the_url to "http://www.findory.com/rss/Blogs?q=" & search_term
    -- subscribe to the_url

    -- sucks
    -- set the_url to "http://feedster.com/search.php?q=" & search_term & "&sort=date&ie=UTF-8&limit=15&type=rss"
    -- subscribe to the_url

    -- sucks
    -- set the_url to "http://www.daypop.com/search?q=" & search_term & "&s=1&c=10&t=a&o=rss"
    -- subscribe to the_url
  end repeat
end tell

Exporting Keynote 3 as PDF

| | Comments (0)

NOTE: This version runs on Keynote 3, bundled with iWork '08. If you have Keynote 2, you want my older version.

on run
  display dialog "Drag keynote documents on me to convert to PDF."
end run

on open draggeditems
  repeat with thisFile in draggeditems as list
    tell application "Finder" to reveal item thisFile
    set thisFile to thisFile as alias

    tell application "Keynote" to open thisFile

    tell application "System Events"
      tell application process "Keynote"
        set frontmost to true

        if menu item "Hide Inspector" of menu 1 of menu bar item "View" of menu bar 1 exists then
          keystroke "i" using {command down, option down}
        end if

        click menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1

        repeat until sheet 1 of window 1 exists
        end repeat

        tell sheet 1 of window 1
          click button "PDF" of radio group 2
          click checkbox "Include slide numbers"
          click checkbox "Include date"
          click checkbox "Print each stage of builds"
          click button "Next…"
        end tell

        repeat until button "Export" of sheet 1 of window 1 exists
        end repeat

        tell sheet 1 of window 1
          click button "Export"
        end tell

        delay 3
        keystroke "w" using command down
      end tell
    end tell

  end repeat
end open

NOTE: This is for keynote 2, which is bundled with iWork '07. I've posted an updated script for keynote 3.

on run
  display dialog "Drag keynote documents on me to convert to PDF."
end run

on open draggeditems
  repeat with thisFile in draggeditems as list
    tell application "Finder" to reveal item thisFile
    set thisFile to thisFile as alias

    tell application "Keynote" to open thisFile

    tell application "System Events"
      tell application process "Keynote"
        set frontmost to true

        if menu item "Hide Inspector" of menu 1 of menu bar item "View" of menu bar 1 exists then
          keystroke "i" using {command down, option down}
        end if

        click menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1

        repeat until sheet 1 of window 1 exists
        end repeat

        tell sheet 1 of window 1
          click radio button "PDF" of radio group 1
          click button "Next…"
        end tell

        repeat until button "Export" of sheet 1 of window 1 exists
        end repeat

        tell sheet 1 of window 1
          click button "Export"
        end tell

        delay 3
        keystroke "w" using command down
      end tell
    end tell

  end repeat
end open

<deep sigh>

Hi, my name is Ryan and... and I am an info-junkie.

Hi Ryan!

I use NetNewsWire (pro) to read my newsfeeds. Too many newsfeeds. I've got 178 feeds currently tho that fluctuates. I've got them grouped into prioritized groups so I can focus on certain ones more than others, like "ruby" vs "ruby-bored". I know that's not good... but... That works pretty well, actually.

Why I'm really here... my real problem... From these feeds, I queue up even more. Like, I read wiki update feeds and queue up whole pages to read for later. Loads of them. 132 of them right now. I'm weak. I know it. I gotta know! But since I can't group them the way I can the feeds, I'd like SOME way to bring some order out of chaos...

for apeiros:

class Numeric
  def commify(dec='.', sep=',')
    num = to_s.sub(/\./, dec)
    dec = Regexp.escape dec
    num.reverse.gsub(/(\d\d\d)(?=\d)(?!\d*#{dec})/, "\\1#{sep}").reverse
  end
end

Episode 3 of the "Stupid Thing I Wrote", figure out the worst actors on IMDB:

  1. 194 Paris Hilton (The Hillz, Bottoms Up)
  2. 183 Jim Varney (Snowboard Academy, 3 Ninjas: High Noon at Mega Mountain)
  3. 177 Hulk Hogan (Santa with Muscles, 3 Ninjas: High Noon at Mega Mountain)
  4. 174 Kal Penn (Son of the Mask, Epic Movie, Van Wilder 2: The Rise of Taj)
  5. 171 Clint Howard (Santa with Muscles, House of the Dead)
  6. 168 Jack McGee (Chairman of the Board, Cool as Ice)
  7. 164 Corey Haim (Snowboard Academy, Last Resort)
  8. 162 Deezer D (In the Mix, Cool as Ice)
  9. 159 Gary Anthony Sturgis (Daddy's Little Girls, Pride)
  10. 157 Myles Fitzgerald (SuperBabies: Baby Geniuses 2, Baby Geniuses) / Gerry Fitzgerald (SuperBabies: Baby Geniuses 2, Baby Geniuses) / Leo Fitzgerald (SuperBabies: Baby Geniuses 2, Baby Geniuses) / Will Sanderson (House of the Dead, Alone in the Dark, BloodRayne)
  11. 153 Gabrielle Union (Daddy's Little Girls, The Honeymooners)
  12. 151 Terrence Howard (Glitter, Pride)
  13. 150 Valarie Pettiford (Glitter, Stomp the Yard) / Jack Warden (Chairman of the Board, Ed) / Mickey Knox (Ghosts Can't Do It, Bolero, Ghoulies II)
  14. 142 Kevin Smith (Bottoms Up, Doogal)
  15. 138 Jürgen Prochnow (House of the Dead, Primeval)
  16. 136 Meagan Good (Stomp the Yard, You Got Served)
  17. 127 Bo Derek (Ghosts Can't Do It, Bolero)
  18. 123 Victor Wong (3 Ninjas: High Noon at Mega Mountain, Shanghai Surprise)
  19. 116 Jon Polito (The Honeymooners, Happily N'Ever After)
  20. 110 Billy Zane (Going Overboard, BloodRayne)

code after the cut.

It makes me sad that "You Got Served" is no longer the worst movie on IMDB.

PNG is an almost-pure-ruby PNG library. It lets you write a PNG without any C libraries.

FEATURES

  • Very simple interface.
  • Outputs simple PNG files with ease.
  • Basic PNG reader as well (someday it might do compositing and the like!).
  • Almost pure ruby, does require a compiler.

SYNOPSYS

require 'png'

canvas = PNG::Canvas.new 200, 200

# Set a point to a color
canvas[100, 100] = PNG::Color::Black

# draw an anti-aliased line
canvas.line 50, 50, 100, 50, PNG::Color::Blue

png = PNG.new canvas
png.save 'blah.png'

Changes:

1.1.0 / 2007-03-26

  • 4 major enhancements:
    • Fixed and incorporated Dominik Barathon's optimizations.
    • Wrote inline methods for pngcrc and pngjoin. Now about 15x faster overall.
    • Basic PNG loading.
    • Reoriented x/y origin to bottom left. This will break things!
  • 3 minor enhancements:
    • Awesome ascii art patches from Tom Werner: Canvas#inpsect, Canvas#tos, Color#toascii.
    • Switched to Hoe.
    • PNG.pie_chart from png/pie.
  • 1 bug fix:
    • Fixed bug in PNG::Canvas#each.

Allows you to lay out HTML using ASCII art. Stolen from psykotic's code posted to reddit: http://programming.reddit.com/info/k9dx/comments

SYNOPSIS:

require 'box_layout'

page_template = <<-END
----------
|        |
----------
| |    | |
| |    | |
| |    | |
| |    | |
----------
|        |
----------
END

layout = BoxLayout.html page_template
puts "<title>cute</title>"
puts "<style>* { border: 1px solid black }</style>"
puts layout % %w[header left body right footer].map {|s| "**#{s}**" }

1.0.0 / 2007-03-24

  • 1 major enhancement
    • Birthday!
require 'rubygems'
require 'ruby2ruby'

p = proc { |x| x + 1 }
puts p.to_ruby
# => proc { |x|
#      (x + 1)
#    }

About this Archive

This page is a archive of recent entries in the Toys category.

Thoughts / Misc is the previous category.

ZenObfuscate is the next category.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.1