from collections.abc import Iterable
def deep_flatten(lst):
return [a for i in lst for a in deep_flatten(i)] if isinstance(lst, Iterable) else [lst]
deep_flatten([1, [2], [[3], 4], 5]) # [1,2,3,4,5]
{% if template contains 'page' and page.url == '/pages/shop' %} | |
{% assign main_menu = linklists['shop-menu'] %} | |
{% else %} | |
{% assign main_menu = linklists[section.settings.main_linklist] %} | |
{% endif %} |
<style>#insta-feed{width:{{section.settings.feed_width}}%;}#insta-feed h2{font-size:{{section.settings.heading_size}}px;font-family: {{section.settings.heading_font.family }};}{{ section.settings.heading_font | font_face }}</style>{{section.settings.html_area}}{% unless section.settings.html_area contains "feed-" %}<div id="insta-feed"></div>{% endunless %}{%schema%}{"name":"Instafeed App","settings":[{"type":"font_picker","label":"Heading font.","id":"heading_font","default": "helvetica_n4"},{"type":"range","id":"heading_size","min":10,"max":30,"step":1,"unit":"px","label":"Heading Size","default":20},{"type":"range","id":"feed_width","min":50,"max":100,"step":5,"unit":"%","label":"Feed Width","default":100},{"type":"html","id":"html_area","label":"Custom Code (optional)","default":"<!-- -->","info":"Save to see your changes"}],"presets":[{"name":"Instafeed App","category":"Instagram Feed"}]}{%endschema%} |
<script type="text/javascript"> | |
(function() { | |
{% if request.page_type=='collection' %} | |
{% assign tmp = "tmx-collection-" | append: collection.handle %} | |
{% elsif request.page_type=='page' %} | |
{% assign tmp = "tmx-page-" | append: page.handle %} | |
{% elsif request.page_type=='product' %} | |
{% assign tmp = "tmx-product-" | append: product.handle %} | |
{% elsif request.page_type=='article' %} | |
{% assign tmp = "tmx-article-" | append: article.handle %} |
<div class="collection-hero__title-wrapper"> | |
<h1 class="collection-hero__title page-width"> | |
<span class="visually-hidden">{{ 'collections.general.collection_label' | t }}: </span> | |
<!-- collection.title --> | |
</h1> | |
</div> |
var links = document.links; | |
for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { | |
if (links[i].hostname !== window.location.hostname) { | |
links[i].target = '_blank'; | |
links[i].rel = 'noreferrer noopener'; | |
} | |
} |
/* site nav dropdown */ | |
.site-nav__dropdown ul { | |
@include media-query($medium-up) { | |
width: 400px; | |
} | |
& li { | |
@include media-query($medium-up) { | |
width: 200px; | |
float: left; | |
} |
<div>[text* your-name placeholder "Name"]</div> | |
<div>[email* your-email placeholder "Email"]</div> | |
<div>[text* your-mobile placeholder "Mobile"]</div> | |
<div>[select* your-event first_as_label "Select an Event" "Brand Launch Exclusive"]</div> | |
<div>[submit "SUBMIT"]</div> |
from collections.abc import Iterable
def deep_flatten(lst):
return [a for i in lst for a in deep_flatten(i)] if isinstance(lst, Iterable) else [lst]
deep_flatten([1, [2], [[3], 4], 5]) # [1,2,3,4,5]
def decapitalize(s, upper_rest=False):
return s[:1].lower() + (s[1:].upper() if upper_rest else s[1:])
decapitalize('FooBar') # 'fooBar'
decapitalize('FooBar', True) # 'fOOBAR'
def dropna(lst):
return list(filter(None, lst))
dropna([0, 5, False, 3, '', None, 1, 'b', 'K', 78]) # [ 5, 3, 1, 'b', 'K', 78 ]