Skip to content

Instantly share code, notes, and snippets.

print('hello from iodide-toolbox');
@burgalon
burgalon / application_helper.rb
Created June 15, 2020 13:22
Rails Ellipsis helper with toggle
def ellipsis_text(s, limit=90)
if s&.length>limit
(s.slice(0..limit) +
'... ' +
content_tag(:a, 'More',
class: 'more semibold small',
href: '#',
onClick: "$(this.nextElementSibling).removeClass('hide'); $(this).addClass('hide'); return false;") +
content_tag(:span, s.slice(90..-1), class: 'hide')).html_safe
else
@burgalon
burgalon / scroll.scss
Created July 20, 2020 08:49
Scrollable custom bar hiding Windows scrollbars and overlaying scrollbars on top
.scrollable-y-with-hide {
overflow-y: hidden;
&:hover {
overflow-y: auto;
// https://stackoverflow.com/a/54979559/375050
// only for WebKit so that scrollbars do not take space and cause content to overflow
overflow-y: overlay;
}
&::-webkit-scrollbar-thumb {
background: hsla(0%, 0%, 0%, 0.4);