View gist:29913
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
# this is a tricky method used to pull a report to review out of the pool of | |
# possible reports, it can return nothing when there are no reports or when | |
# there are simply no qualifying reports for the student to review. read | |
# *carefully* if you plan on modifying it | |
# | |
def find_lettuce_report_to_review options = {} | |
options.to_options! | |
student = options.delete(:student) or raise 'no student' | |
transaction do |
View gist:29916
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 write(content, private_gist) | |
url = URI.parse('http://gist.github.com/gists') | |
req = Net::HTTP.post_form(url, data(nil, nil, content, private_gist)) | |
copy(req['Location']) + "\n#{ content }" | |
end |
View gist:29918
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 write(content, private_gist) | |
url = URI.parse('http://gist.github.com/gists') | |
req = Net::HTTP.post_form(url, data(nil, nil, content, private_gist)) | |
created = copy(req['Location']) | |
"#=> #{ created }\n\n#{ content }" | |
end |
View gist:29930
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
cfp:~ > search `gemdir rack` mongrel -v|grep require | |
/opt/local/lib/ruby/gems/1.8/gems/rack-0.4.0/lib/rack/handler/evented_mongrel.rb +1 : require 'swiftcore/evented_mongrel' | |
/opt/local/lib/ruby/gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb +1 : require 'mongrel' | |
/opt/local/lib/ruby/gems/1.8/gems/rack-0.4.0/test/spec_rack_mongrel.rb +4 : require 'rack/handler/mongrel' | |
/opt/local/lib/ruby/gems/1.8/gems/rack-0.4.0/test/spec_rack_mongrel.rb +169 : $stderr.puts "Skipping Rack::Handler::Mongrel tests (Mongrel is required). `gem install mongrel` and try again." |
View gist:30081
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 index | |
@documents = @current_company.documents.find(:all).sort_by{|document| document.updated_at}.reverse | |
ignore = [ %r/[.]xbrl([.]tgz)$/ ] #, %r/^qval[.]/ | |
@documents.delete_if{|document| ignore.any?{|pattern| pattern.match(document.filename)}} | |
# @documents.delete_if{|document| document.private} | |
end | |
View gist:30082
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
#!/usr/bin/env ruby | |
=begin | |
INSTALL: | |
curl http://github.com/defunkt/gist/tree/master%2Fgist.rb?raw=true > gist && | |
chmod 755 gist && | |
sudo mv gist /usr/local/bin/gist |
View gist:30259
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
<%= | |
subnav( | |
'All teachers', | |
link_to('Create a new teacher', new_teacher_path), | |
link_to('Create new teachers in bulk', :action => 'add_teacher_accounts') | |
) | |
%> | |
<%= | |
table_(:class => 'simple'){ |
View gist:31014
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
# force const_missing to preload these classes | |
# | |
ActionController | |
ActionController::Base | |
ActiveRecord | |
ActiveRecord::Base | |
# support for using helper methods in controllers/models | |
# | |
class Helper |
View gist:31015
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
# force const_missing to preload these classes | |
# | |
ActionController | |
ActionController::Base | |
ActiveRecord | |
ActiveRecord::Base | |
# support for using helper methods in controllers/models | |
# | |
class Helper |
View gist:31016
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
require 'cgi' | |
=begin | |
module CGI | |
def CGI.escape(string) | |
string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do | |
'%' + $1.unpack('H2' * $1.size).join('%').upcase | |
end | |
end | |
end |
OlderNewer