Skip to content

Instantly share code, notes, and snippets.

// Function to send the size of the page to the parent
const sendSize = function () {
const message = {
iframeResize: {
height: document.body.scrollHeight,
width: document.body.scrollWidth
}
};
window.top.postMessage(message, "*");
};
var casper = require('casper').create();
casper.start('http://casperjs.org/');
casper.then(function() {
this.echo('First Page: ' + this.getTitle());
});
casper.thenOpen('http://phantomjs.org', function() {
this.echo('Second Page: ' + this.getTitle());
});
@ay13
ay13 / spec.js
Last active August 29, 2015 14:03
Changing a <select> in a Protractor E2E test
element(by.model('operator')).element(by.css('option[value="DIVISION"]')).click();
@ay13
ay13 / Gruntfile.js
Last active August 29, 2015 13:58
Grunt bake personalizations
bake: {
build: {
options: {
// Change parse pattern from "{{ }}" to "{% %}" to stop interference with handlebars
parsePattern: '/{%s?([.-w]*)s?%}/g'
},
files: grunt.file.readJSON('bake-files.json')
}
}
@ay13
ay13 / mixin
Created November 29, 2012 22:03
sass/compass mixin for returning background path, background position, width and height
@mixin sprite_url_height_width($sprite_name, $image_name) {
background: sprite($sprite_name, $image_name) no-repeat;
width: image-width(sprite-file($sprite_name, $image_name));
height: image-height(sprite-file($sprite_name, $image_name));
}