pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Ruby pastebin - collaborative debugging tool View Help


Posted by pedro mg on Sun 18 Nov 04:09
report abuse | View followups from zimbatm | download | new post

  1. class Static < R '/static/(.+)'
  2.     MIME_TYPES = { '.css' => 'text/css', '.js' => 'text/javascript',
  3.                    '.jpg' => 'image/jpeg', '.png' => 'image/png' }
  4.     def get(file)
  5.       @headers['Content-Type'] = MIME_TYPES[file[('/\.\w+$/')]] || 'text/plain'
  6.       unless file.include?".."
  7.         @headers['X-Sendfile'] = "#{File.expand_path(File.dirname(__FILE__))}/static/#{file}"
  8.       else
  9.         @status = "403"
  10.         "403 - Path Not Found!"
  11.       end
  12.     end

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post