Skip to content

Instantly share code, notes, and snippets.

💭
probably outside if i'm not hacking.

ara.t.howard ahoward

💭
probably outside if i'm not hacking.
Block or report user

Report or block ahoward

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:29913
# 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
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
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
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
################################################################################
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
#!/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
<%=
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
# 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
# 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
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
You can’t perform that action at this time.