Skip to content

Instantly share code, notes, and snippets.

View ahoward's full-sized avatar
💭
probably outside if i'm not hacking.

ara.t.howard ahoward

💭
probably outside if i'm not hacking.
View GitHub Profile
# 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
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
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
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."
################################################################################
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
#!/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
<%=
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'){
# force const_missing to preload these classes
#
ActionController
ActionController::Base
ActiveRecord
ActiveRecord::Base
# support for using helper methods in controllers/models
#
class Helper
# force const_missing to preload these classes
#
ActionController
ActionController::Base
ActiveRecord
ActiveRecord::Base
# support for using helper methods in controllers/models
#
class Helper
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