Skip to content

Instantly share code, notes, and snippets.

@mwin007
mwin007 / 0_reuse_code.js
Created July 3, 2014 18:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mwin007
mwin007 / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mwin007
mwin007 / fiddle.response.json
Created October 19, 2015 00:11 — forked from szilardhuber/fiddle.response.json
Rect and Angular
{"id":708083,"data":[[800,"0001","0100000000",1995,1,"","","","","40","S","","","","S","","","","","6.14","12.00","0.00","6.14","EUR","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","","","",0,"","0.00","0.00000","0.00","0.00","0.00","19950606","19950606","","","","","","RFBU","","","0.00","",0,"","","","","","",0,0,"","","","",0,"","","X","","","","","","","","","","","","","","","","","0000100000","","","","X","","","","",0,0,0,"0.000","0.000","0.00","0.00","0.00","","","","","","0.00","","0.00","0.00","","0.00","0.00","","0.00","0.00","",0,0,"","","","","","",0,0,"","","",0,0,"","",0,"","","0.00","","0.00","","","",0,"","","","","0.00","","0.00","0.00","0.00","0.00","","","0.000","","0.000","","0.000","","",0,0,"","",0,"","","","0.00","0.00","0.00","0.00","","0.00","","","","","","","","","","","","",0,"0.00","0.00","","","","","","","","","","","","","","0.000000","","","","0",0,"0","0",0,"","","","","",0,"","6.14","7.37","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00"
@mwin007
mwin007 / gist:16121c1ac244eec5cf35
Created October 30, 2015 10:24
Multi steps form demo
<form id="demo-form" data-parsley-validate>
<div class="first block1 show">
<label for="firstname">Firstname:</label>
<input type="text" name="firstname" data-parsley-group="block1" required/>
<label for="lastname">Lastname:</label>
<input type="text" name="lastname" data-parsley-group="block1" required />
<span class="next btn btn-info pull-right" data-current-block="1" data-next-block="2">Next ></span>
</div>
<script>$_SKIN_URL = ‘<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).’frontend/default/default/’;?>’;</script>
<script src=”<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).’js/quickContact/jquery.js’?>” type=”text/javascript”></script>
<script src=”<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).’js/quickContact/jquery_noconflict.js’?>” type=”text/javascript”></script>
<script src=”<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).’js/quickContact/modalwindow.js’?>” type=”text/javascript”></script>
<script src=”<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).’js/quickContact/quickContact.js’?>” type=”text/javascript”></script>
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):e.parsley=t(e.jQuery)}(this,function(e){"use strict";function t(e,t){return e.parsleyAdaptedCallback||(e.parsleyAdaptedCallback=function(){var i=Array.prototype.slice.call(arguments,0);i.unshift(this),e.apply(t||M,i)}),e.parsleyAdaptedCallback}function i(e){return 0===e.lastIndexOf(O,0)?e.substr(O.length):e}var n=1,r={},s={attr:function(e,t,i){var n,r,s,a=new RegExp("^"+t,"i");if("undefined"==typeof i)i={};else for(n in i)i.hasOwnProperty(n)&&delete i[n];if("undefined"==typeof e||"undefined"==typeof e[0])return i;for(s=e[0].attributes,n=s.length;n--;)r=s[n],r&&r.specified&&a.test(r.name)&&(i[this.camelize(r.name.slice(t.length))]=this.deserializeValue(r.value));return i},checkAttr:function(e,t,i){return e.is("["+t+i+"]")},setAttr:function(e,t,i,n){e[0].setAttribute(this.dasherize(t+i),String(n))},generateID:function(){return""+n++},deserializeValue:
Validation.add('IsEmpty', '', function(v) {
return (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v)); // || /^\s+$/.test(v));
});
Validation.addAllThese([
['validate-select', 'Please select an option.', function(v) {
return ((v != "none") && (v != null) && (v.length != 0));
}],
['required-entry', 'This is a required field.', function(v) {
return !Validation.get('IsEmpty').test(v);
'validate-select', ''
'required-entry', 'This is a required field.'
'validate-number', 'Please enter a valid number in this field.'
'validate-digits', 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.'
'validate-alpha', 'Please use letters only (a-z or A-Z) in this field.'
'validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'
'validate-alphanum', 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'
'validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.'
'validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.'
'validate-phoneLax', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.'
var theForm = new VarienForm('frm_id', true);
Where frm_id is your form id
if (theForm.validator && theForm.validator.validate())
{
// if validation successful pass then
}
else