Skip to content

Instantly share code, notes, and snippets.

class ConversationsController < ApplicationController
before_filter :authenticate_user!
helper_method :mailbox, :conversation
def index
@conversations ||= current_user.mailbox.inbox.all
end
def outbox
@conversations ||= current_user.mailbox.sentbox.all
def get_links
needle = /#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be\/)[^&\n]+#/
bracket_needle = /\[(.*?)\]/
links = @doc.search("a.title.may-blank").each do |x|
y = x['href']
t = y.scan(needle)
unless t.empty?
#important part is here
# puts x.text
def usertags
if params[:tags] != nil
@tags = params[:tags]
session[:tags] = @tags
@videos = Video.tagged_with(session[:tags]).order("views DESC").page params[:page]
else
session[:tags] = nil
@videos = Video.order(views: :desc).page params[:page]
end
respond_to do |format|
def draft
@params = params[:tags]
respond_to do |format|
format.js
end
end
function eval_tags (){
tags = $('#tags').val()
$.get("/tags/usertags/", $('#tags').val())
.done(function() {
alert( "second success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
class FavoritesController < ApplicationController
before_filter :authenticate_user!
before_action :set_favorite, only: [:show, :edit, :update, :destroy]
# GET /favorites
# GET /favorites.json
def index
@favorites = current_user.favorites
end