entering a password all the time sucks. This is maybe naughty but I like it :shrug
# open sudoers file in editor (nano)
sudo nano /etc/sudoers
in the edit append the following line
{% comment %} | |
Snippet 'responsive-content' | |
This snippet takes rich text content (ie product.description, article.content etc) and, where possible, adds responsive image markup | |
Requires snippet 'responsive-image' to be defined (https://gist.github.com/wmulligan87/d2065346592eb3929147dbeca342f64c) | |
Usage: | |
{% include 'responsive-content' with article.content %} | |
{% endcomment %} |
{% comment %} | |
Place at bottom of DOM, before </body> | |
{% endcomment %} | |
{% comment %} | |
Article structured data | |
https://developers.google.com/search/docs/data-types/articles | |
{% endcomment %} | |
{% if template contains 'article' %} |
{% comment %} | |
Use this snippet to add a responsive image to page. | |
Requires lazysizes.js | |
Specify Shopify image you want to make responsive in the "with" parameter (see examples below). | |
You can use following variables to customize the image | |
* type: specifies the type of image file being accessed (ie an image from content, a product image, or a theme asset image). | |
* default_size: size of placeholder image until full image is loaded (default: '150x') |
# value arg could be Array of objects, or single object | |
def print_this(value) | |
print = '' | |
(value.is_a?(Array) ? value : [value]).each do |v| | |
print += v | |
end | |
puts print | |
end | |
# eg |
// General loadmasking for all ajax controls using jquery loadmask | |
// Prevents double requests and gives users better feedback ('Did i click that properly?'), especially on touch devices. | |
// On ajaxBefore (which equates to onclick in most cases) a mask will render over the target element | |
// On ajaxComplete the mask is destroyed. | |
// requires jquery.loadmask.js (@ https://code.google.com/p/jquery-loadmask/) | |
$(document).on('ajaxBefore', function(event, request) { | |
return $(event.target).mask('loading...'); | |
}).on('ajaxComplete', function(event, request) { | |
return $(event.target).unmask(); |
class Line << ActiveRecord::Base | |
belongs_to :group | |
belongs_to :product | |
def build_for_product(product_id) | |
product = Product.find(product_id) | |
line = Line.new( | |
:product => product, | |
:line_type => 'stock', | |
:quantity => 1, |
## Controller | |
## value = send_chain(@activity, 'asset.product.code') | |
def try_chain(record, attrib) | |
attrib.split('.').inject(record) {|o, a| o = o.try(a); o } | |
end | |
## Model | |
## value = send_chain('asset.product.code') |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |