Skip to content

Instantly share code, notes, and snippets.

View JumboLove's full-sized avatar

David Witt JumboLove

View GitHub Profile
@JumboLove
JumboLove / debug-box
Created June 7, 2013 13:25
Debug Box
<iscomment>Debugging window: Delete for staging</iscomment>
<isscript>
var testing = "Debugging...";
var log = pdict.Log;
var scriptLog = pdict.ScriptLog;
</isscript>
<div id="mrdebug" style="min-height: 100px; width: 100%; background-color: #BADA55; margin: 0 auto;">
<p>testing : ${testing} </p>
<p> : ${}</p>
</div>
@JumboLove
JumboLove / static-library-image
Created June 7, 2013 13:28
Static Library Image
<img src="${URLUtils.staticURL(URLUtils.CONTEXT_LIBRARY, null, 'ui/')}white-close-icon.png"/>
@JumboLove
JumboLove / remote-include-pipeline
Created June 7, 2013 13:30
Remote Include Pipeline
<isinclude url="${URLUtil.url('Product-IncludeLastVisited', 'cid','about-us')}" />
@JumboLove
JumboLove / custom-site-preference
Created June 7, 2013 13:31
Custom Site Preference
${dw.system.Site.getCurrent().getCustomPreferenceValue('enableSocialNetworkingLinks')}
@JumboLove
JumboLove / set-cookie
Created June 7, 2013 13:32
Set Cookie
@JumboLove
JumboLove / access-cookie
Created June 7, 2013 13:35
Access Cookie
@JumboLove
JumboLove / trigger-click-enter-key
Created June 7, 2013 13:38
Trigger Click event with Enter key press
// Attach keypress handler to input box. Submit form if user presses 'enter' key.
jQuery('.email').keypress( function(e) {
if(e.which == 13) {
jQuery('#sendBtn').click();
return false;
}
return true;
});
@JumboLove
JumboLove / test-email-address
Created June 7, 2013 13:39
Test email address
function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}
@JumboLove
JumboLove / isif-locale
Created June 7, 2013 13:43
Isif by Locale
<isif condition="${dw.system.Site.getCurrent().getID() == 'UK'}">
</isif>
<iscomment>Or use ${request.getLocale()}</iscomment>
@JumboLove
JumboLove / resource-message
Created June 7, 2013 13:44
Resource Message
${Resource.msg('newcheckout.cancel','checkout',null)}
//OR if you want to pass a value to the string
${Resource.msgf('checkout.missing','checkout',null, field.name)}