This file contains 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
$scope.$watch(function() {return $scope.bookingData;}, function() { | |
console && console.log(1); | |
Storage.set(CFG.cfg.cookies.bookingflow.name, $scope.bookingData); | |
}, true) |
This file contains 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
<div class="grp" ng-class="{passed: (theForm.fname.$dirty && theForm.fname.$valid) }"> |
This file contains 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
app.directive('bubble', function() { | |
return function(scope, element, attrs) { | |
// Whatever the data-bubble attr is set to will | |
// be the expression we watch. | |
var expr = attrs.bubble; | |
scope.$watch(expr, function(val) { | |
if (val > 0) { | |
element.attr('data-bubble', val); | |
} else { |
This file contains 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
angular.module('foo', []).directive('enableifformisvalid', function() { | |
return { | |
restrict: 'A', | |
require: '^form', | |
link: function(scope, element, attrs, formCtrl) { | |
window.f = formCtrl; | |
scope.$watch(function() {return formCtrl.$valid;}, function(newVal, oldVal) { | |
console && console.log('newVal', newVal); | |
console && console.log('oldVal', oldVal); | |
}); |
This file contains 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 tweet = "Currently chilling out at W1B 2EL, then on to WC2E 8HA or maybe even L1 8JF! :-)"; | |
// Here's a simple regex that tries to recognise postcode-like strings. | |
// See http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation | |
// for the rules on how UK postcodes are formatted. | |
var postcode_regex = /[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}/g; | |
var postcodes = tweet.match(postcode_regex); | |
console.log(postcodes); |
This file contains 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 sumAny = function() { | |
var sum = 0; | |
_.each(arguments, function(arg) { | |
var _num; | |
_num = parseInt(arg); | |
if (!isNaN(_num)) sum += _num; | |
}); | |
return sum; | |
} |
This file contains 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
exports.isString = function(v) { | |
return (typeof v === 'string'); | |
} | |
exports.isInteger = function(v) { | |
return (parseInt(v) === v) | |
} | |
exports.isFloat = function(v) { | |
return ((v % 1) > 0) |
This file contains 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 re = new RegExp("regex","g"); | |
// or | |
new RegExp(someObj.path).test(url) | |
// also | |
// this.appConfig.appPath.photo = 'photo/' | |
var re = new RegExp(this.appConfig.appPath.photo+'+.'); |
This file contains 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
/* | |
The width and height properties include the padding and border, but not the margin. | |
https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing | |
Default: content-box | |
*/ | |
element { | |
box-sizing: border-box; | |
} |
This file contains 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 writeScreenshot(data, name) { | |
name = name || 'ss.png'; | |
var screenshotPath = 'C:\\selenium_local_map\\'; | |
fs.writeFileSync(screenshotPath + name, data, 'base64'); | |
}; | |
driver.takeScreenshot().then(function(data) { | |
writeScreenshot(data, 'out1.png'); | |
}); |