Discover gists
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>this is a page title</title> | |
</head> | |
<body> | |
<p>this is a body</p> |
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 get_remote_file(uri) | |
require 'open-uri' | |
begin | |
uploadedfile = nil | |
open(uri) do |remote| | |
uploadedfile = StringIO.new(remote.read) | |
filename = File.basename(uri) | |
(class << uploadedfile; self; end).class_eval do | |
define_method(:local_path) { "" } | |
define_method(:original_filename) { filename } |
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
module WithScopes | |
def with_scopes(*named_scopes) | |
named_scopes.inject(self) { |klass, scope| klass.send(scope) } | |
end | |
end | |
ActiveRecord::Base.extend(WithScopes) |
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 test | |
str = "this is a test of new pastie" | |
# print out the test msg | |
puts str | |
end |
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
WTFsrsly |
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
aif = function(_) { | |
_ = Array.slice(arguments) | |
return(each(_, function(i) { | |
if(i % 2 == 0 && !!this) { | |
return(fn.apply(this)) | |
} | |
})) | |
} |
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
test edit of my gist |
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 test | |
str = "this is a test of new pastie" | |
# print out the test msg | |
puts str | |
end |
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
Another test paste I guess |