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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 myHtml = `<div billing-total="" quote="quote" payment-frequency="frequency" on-select-frequency="onSelect(frequency)" payment-plan="plan" class="ng-scope ng-isolate-scope"><div class="billing-frequency-wrap container"><div class="billing-total col col-lg-3 col-md-3 col-sm-8 col-xs-4"><div class="frequency"><div class="freq-select"><div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label getmdl-select text-input"><label for="paymentFrequency" class="mdl-textfield-label-right"><i class="material-icons filled">done</i> <i class="mdl-icon-toggle__label material-icons">arrow_drop_down</i></label><span><i class="material-icons filled">done</i></span> <input class="mdl-textfield__input" type="text" id="paymentFrequency" placeholder="Monthly" readonly="readonly" value=""><label for="paymentFrequency" class="mdl-textfield__label"><span>Billing Frequency</span></label><div class="getmdl-select-container" ng-click="setPaymentFrequency($event);"><ul for="paymentFrequency" class="mdl-menu mdl-js-menu m |
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
<html ng-app="myApp"> | |
<head> | |
<style> | |
body {background-color:#cecece; margin:0; padding:0; font-family:Arial; } | |
body>div:first-child {width:50%; margin:auto; margin-top:40px;} | |
table {border:none; border-collapse:collapse; width:100%;} | |
table tr { border:none;} | |
table tr td { border:none; font-size:37px; font-weight:bolder;} | |
table tr:first-child{background-color:#00ff00;} | |
table tr:nth-child(2n){ background-color:blue;} |
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Post Message Example</title> | |
<script src="/assets/javascripts/jquery.min.js"> </script><!-- jquery --> | |
<script src="/assets/javascripts/jquery.ba-postmessage.min.js"> </script><!-- plugin --> | |
</head> | |
<body> |
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
by.addLocator('text', | |
/** | |
* | |
* @param {string} text - will be lowercased | |
* @param {string} selector - to get list of children, css | |
* @param {object|null} parent - protractor will provide this.. | |
*/ | |
function(text, selector, parent) { | |
return _.filter($(parent || 'body').find(selector), function(e){ |
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 logger = require('log4js').getLogger('normalize'); | |
var chalk = require('chalk'); | |
chalk.enabled = true; | |
beforeEach(function(){ | |
console.log( chalk.bold.blue('currently running :: ' + jasmine.getEnv().currentSpec.getFullName())); | |
// define new matchers |
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(){ | |
var rows = _.map($('table tr'), function(r){ | |
return _.map($(r).find('td'),function(c){ | |
var $c = $(c); | |
if ( $c.children().length > 0){ // get only visible text | |
return $(c).find('*:not(:has(*)):visible').text(); | |
}else{ // no children.. get text | |
return $(c).text(); | |
} |
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
// Code goes here | |
function Animal(){ | |
this.type = 'abstract'; | |
this.sayGoodbye = function(){ | |
return 'goodbye'; | |
} | |
} |
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 WRONG way | |
* | |
* - requires method to be in Controller - see $scope and $http usage.. lack of separation. | |
* - copy paste of callback.. lack of use of promise behavior, no proper error handling | |
* | |
**/ | |
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
/** | |
* | |
* @description | |
* | |
* a utility function to help mock promises. Using $q for mocks in tests is a bad practice. tests should not be asyncronous. | |
* This mock makes a synchronous promise like mechanism. | |
* I found it answers at least 80% of my use-cases and reduces code significantly. | |
* | |
* Usage: | |
* |
NewerOlder