Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. def write(location, data)
  2.   path = Pathname.new(location)
  3.   raise "Location does not exist" unless path.exist?
  4.  
  5.   File.open(path, "w") do |file|
  6.     file_data = file.read
  7.     super(location, file_data)
  8.     return false if Digest::MD5.hexdigest(file_data) == data.hash
  9.     file.puts YAML.dump(data)
  10.   end
  11.  
  12.   return true
  13. end




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2017