Skip to content

Instantly share code, notes, and snippets.

@Kolenov
Kolenov / images_helper.rb
Last active May 7, 2018 11:05 — forked from youngbrioche/images_helper.rb
Responsive images helper using srcset in Rails
# frozen_string_literal: true
module ImagesHelper
# Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags
# for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers.
#
# image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image'
# => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image">
#
# image_set_tag 'logo-amzlenders.png', {'logo-amzlenders@2x.png' => '2x'}
# => <img srcset="/assets/logo-amzlenders@2x.png 2x" src="/assets/logo-amzlenders.png" alt="Logo amzlenders">
@Kolenov
Kolenov / svg_helper.rb
Last active November 1, 2017 10:45 — forked from josepmartins/inline_svg_helpers.rb
SVG inline helpers for Rails
# Inline svg from @tomeara https://gist.github.com/tomeara/6515860
def inline_svg(source)
file = File.open("app/assets/images/#{source}", "rb")
raw file.read
end
# SVG internal link
#= svg_tag 'sprite/icons.svg', 'icon-facebook-invers'
module SvgHelper
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
@Kolenov
Kolenov / smb.conf.ini
Created July 21, 2017 19:40 — forked from raspi/smb.conf.ini
FreeBSD ZFS Samba 4 config with recycle and read/write optimizations example
# Samba 4 config example
# Connected to existing remote Samba 4 Active Directory Directory Controller
# ZFS pool @ /storage
# Network is 192.168.101.0/24
# Samba is installed with:
# pkg install samba42
# and then joined to existing AD with:
# samba-tool domain join <params>
# After this /usr/local/etc/smb4.conf is edited and restarted with /usr/local/etc/rc.d/samba_server restart