Skip to content

Instantly share code, notes, and snippets.

View acrogenesis's full-sized avatar
🤖
Beep Boop

Adrian Rangel acrogenesis

🤖
Beep Boop
View GitHub Profile
@acrogenesis
acrogenesis / application_helper.rb
Last active January 2, 2016 01:39
Railscasts Search, Sort, Paginate, AJAX with Bootstrap 2
module ApplicationHelper
def sortable(column, title = nil)
title ||= column.titleize
css_class = column == sort_column ? "current #{sort_direction}" : nil
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
link_to (css_class ? title + direction_icon(direction) : title).html_safe, params.merge(:sort => column, :direction => direction, :page => nil), {:class => css_class}
end
private
@acrogenesis
acrogenesis / Dropbox Duplicates
Created December 21, 2013 18:46
Remove Dropbox Duplicates
find -L ~/Dropbox -name "*conflicted copy*" -exec rm {} \;
@acrogenesis
acrogenesis / foundation_will_paginate
Created September 27, 2013 17:17
Foundation Will_paginate
module ApplicationHelper
class FoundationLinkRenderer < ::WillPaginate::ActionView::LinkRenderer
protected
def html_container(html)
tag(:ul, html, container_attributes)
end
def page_number(page)
tag :li, link(page, page, :rel => rel_value(page)), :class => ('current' if page == current_page)