This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
narf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
narf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Override Paperclip's content-type guessing support to add more MIME types. | |
# We actually have to monkey-patch File to do this, because Paperclip | |
# monkey-patches File to add #content_type (from module Paperclip::Upfile). | |
class File | |
def content_type_with_extras | |
type = (self.path.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase | |
case type | |
when "pdf" then "application/pdf" | |
# add more content types here | |
else content_type_without_extras |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if "[email protected]" =~ /@(.*)/ | |
$1 | |
else | |
raise "bad email" | |
end | |
# => "example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
caller[0][/`([^']*)'/, 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"[email protected]"[/@(.*)/, 1] # => "example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sums_before(src) | |
dest = [0] | |
src.each_with_index do |item, index| | |
dest[index + 1] = dest[index] + item | |
end | |
dest | |
end | |
def equi ( arr ) | |
sums_left = sums_before(arr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Foodiddlybar |
OlderNewer