This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style>@charset "utf-8";body{margin:0}#mocha{font:20px/1.5 "Helvetica Neue",Helvetica,Arial,sans-serif;margin:60px 50px}#mocha ul,#mocha li{margin:0;padding:0}#mocha ul{list-style:none}#mocha h1,#mocha h2{margin:0}#mocha h1{margin-top:15px;font-size:1em;font-weight:200}#mocha h1 a{text-decoration:none;color:inherit}#mocha h1 a:hover{text-decoration:underline}#mocha .suite .suite h1{margin-top:0;font-size:.8em}#mocha .hidden{display:none}#mocha h2{font-size:12px;font-weight:normal;cursor:pointer}#mocha .suite{margin-left:15px}#mocha .test{margin-left:15px;overflow:hidden}#mocha .test.pending:hover h2::after{content:'(pending)';font-family:arial,sans-serif}#mocha .test.pass.medium .duration{background:#c09853}#mocha .test.pass.slow .duration{background:#b94a48}#mocha .test.pass::before{content:'✓';font-size:12px;display:block;float:left;margin-right:5px;color:#00d6b2}#mocha .test.pass .duration{font-size:9px;margin-left:5px;padding:2px 5px;color:#fff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.2);-moz-box-sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <snippet> | |
| <content> | |
| <![CDATA[.${1:m-${SELECTION/[\s:;#]+/-/g}}{${SELECTION};} ]]> | |
| </content> | |
| <!-- Optional: Tab trigger to activate the snippet --> | |
| <tabTrigger>emailformatmobilecss</tabTrigger> | |
| <!-- Optional: Scope the tab trigger will be active in --> | |
| <scope>text.html</scope> | |
| <!-- Optional: Description to show in the menu --> | |
| <description>Email Format Mobile CSS</description> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function recursiveObjectStringSearch(needleString, hayStackObject){ | |
| var result = []; | |
| for(var index in hayStackObject) { | |
| if (hayStackObject.hasOwnProperty(index)) { | |
| if (typeof hayStackObject[index] === 'string'){ | |
| if (needleString.indexOf(hayStackObject[index]) > -1 || hayStackObject[index].indexOf(needleString) > -1) { | |
| result.push(hayStackObject[index]); | |
| continue; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // simple accordion set up for prod tabs | |
| $(document).ready(function(){ | |
| var coSimpleAccordion = (function($) { | |
| 'use strict'; | |
| var coSimpleAccordion = { | |
| init: function() { | |
| $('.tabHead.open').nextAll('div.tabBody').addClass('open').show(); | |
| $('.tabHead.closed').nextAll('div.tabBody').addClass('closed').hide(); | |
| coSimpleAccordion.listen(); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment>define your allowed characters</mvt:comment> | |
| <mvt:assign name="g.allowed" value="'abcdefghijklmnopqrstuvwxyz'" /> | |
| <mvt:comment>the string to scrub</mvt:comment> | |
| <mvt:assign name="g.string" value="'Test123-!hello'" /> | |
| <mvt:assign name="g.counter" value="1" /> | |
| <mvt:comment>for each letter in string</mvt:comment> | |
| <mvt:while expr="g.counter LE len(g.string)"> | |
| <mvt:comment>if this letter is contained in allowed, increment</mvt:comment> | |
| <mvt:if expr="substring(g.string, g.counter, 1) CIN g.allowed"> | |
| <mvt:assign name="g.counter" value="g.counter+1" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| | | |
| | | |
| | Efficient mvt:do custom upcharges - function similar to toolkit upcharges | |
| | assign the 4 below variables and drop in anywhere above basket charge loop | |
| | | |
| | | |
| </mvt:comment> | |
| <mvt:assign name="g.customCharge:value" value="28" /> | |
| <mvt:assign name="g.customCharge:type" value="'CustomUpcharge'" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.time('1'); | |
| var data = [1,4,56,4,6,4,3,6,7,7,4,3,7,5,34,3,5,7,45,43]; | |
| console.log(data.sort().filter(function(n,i){ | |
| return data[i] !== data[i+1]; | |
| })); | |
| console.timeEnd('1'); | |
| console.time('2'); | |
| var data = [1,4,56,4,6,4,3,6,7,7,4,3,7,5,34,3,5,7,45,43]; | |
| var uniq = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:assign name="g.string" value="'one|two|three|four|five|six'" /> | |
| <h3>Split String mvt:do</h3> | |
| <p>Does not inherently support multi-character splitting, you'd have to perform a glosub first (see next example)</p> | |
| <mvt:do file="g.Module_Library_Utilities" name="l.success" value="SplitString( g.string, '|', g.splitString )" /> | |
| <!-- @@ &mvt:global:MvDO_Error; --> | |
| <mvt:foreach iterator="line" array="global:splitString"> | |
| &mvt:line;</br> | |
| </mvt:foreach> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <mvt:comment> | |
| | | |
| | This checks whether the image you're going to send in the twitter card is below 1mb in size, and sends or generates a small version depending | |
| | | |
| </mvt:comment> | |
| <mvt:comment>IF THE IMAGE CUSTOM FIELD IS SET UP</mvt:comment> | |
| <mvt:if expr="l.settings:product:customfield_values:productimagecustomfields:social_image"> | |
| <mvt:comment>IF THE IMAGE'S SIZE IS GREATER THAN 1MB</mvt:comment> | |
| <mvt:if expr="ssize('/mm5/'$l.settings:product:customfield_values:productimagecustomfields:social_image) GT 1000000"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var doorState = 'CLOSED'; | |
| var inputs = ['button_clicked','cycle_complete','button_clicked','button_clicked','button_clicked','button_clicked','button_clicked','cycle_complete']; | |
| console.log('Door: '+doorState); | |
| for (var i = 0; i < inputs.length; i++) { | |
| if (inputs[i] == 'button_clicked') { | |
| //button clicked actions | |
| if (doorState == 'CLOSED' || doorState == 'STOPPED WHILE CLOSING') { | |
| doorState = 'OPENING'; | |
| } | |
| else if (doorState == 'CLOSING') { |
NewerOlder