Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
framework 'Cocoa' NSApplication.sharedApplication delegate = Object.new def delegate.netServiceBrowserWillSearch(browser) puts "search commencing!" end def delegate.netServiceBrowser(browser, didFindService:service, moreComing:more) # this never calls regardless of the services on the network. puts "Found service #{service.name}." end def delegate.netServiceBrowser(browser, didFindDomain:domain, moreComing:more) puts "Found domain #{domain.inspect}." end def delegate.netServiceBrowser(browser, didRemoveService:service, moreComing:more) puts "lost service #{service.name}" end def delegate.netServiceBrowser(browser, didNotSearch:errorInfo) puts "search not successful: #{errorInfo}" end browsers = [] ["growl","ssh", "raop", "http", "git", "daap", "ipp"].each{|svc| browser = NSNetServiceBrowser.new browser.delegate = delegate browser.searchForServicesOfType("_#{svc}._tcp.", inDomain:"") browsers << browser puts "searching for #{svc}" } NSApp.run
This paste will be private.
From the Design Piracy series on my blog: