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]
/* | |
A simple jQuery modal (http://github.com/kylefox/jquery-modal) | |
Version 0.9.1 | |
*/ | |
!function(o){"object"==typeof module&&"object"==typeof module.exports?o(require("jquery"),window,document):o(jQuery,window,document)}(function(o,t,i,e){var s=[],l=function(){return s.length?s[s.length-1]:null},n=function(){var o,t=!1;for(o=s.length-1;o>=0;o--)s[o].$blocker&&(s[o].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};o.modal=function(t,i){var e,n;if(this.$body=o("body"),this.options=o.extend({},o.modal.defaults,i),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;o.modal.isActive();)o.modal.close();if(s.push(this),t.is("a"))if(n=t.attr("href"),this.anchor=t,/^#/.test(n)){if(this.$elm=o(n),1!==this.$elm.length)return null;this.$body.append(this.$elm),this.open()}else this.$elm=o("<div>"),this.$body.append(this.$elm),e=function(o,t){t.elm.remove()},this.showSpinner(),t.trigger(o.modal.AJAX_SEND),o.get(n).done(function(i){if(o.m |
{% 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'