Skip to content

Instantly share code, notes, and snippets.

class ApplicationController < ActionController::Base
protect_from_forgery
class << self
def responder *responders
if responders.any?
responder_class = Class.new(ActionController::Responder)
responders.each do |responder|
responder = responder.is_a?(Module) ? responder : "#{responder.to_s.classify}Responder".constantize
responder_class.send(:include, responder)
@DefV
DefV / gist:241852
Created November 24, 2009 12:52 — forked from pjaspers/gist:241847
require 'lingua/en/readability'
class Haiku
def initialize(text)
@report = Lingua::EN::Readability.new(text)
@used_words = Array.new
end
def get_most_used_words(words)
top_words = Array.new
words.sort{|a,b| a[1]<=>b[1]}.slice(words.length/2..words.length).each do |a|
u = User.find(params[:id])
u.activities.last # Does a find(:last)
# Add something to the activities
u.activities.create!({:description => "List activities"})
u.activities.last # Fetches all activities of the user - Painfull when a user has 30000 activities