Skip to content

Instantly share code, notes, and snippets.

View antony's full-sized avatar
:octocat:
Loving SvelteJS

Antony Jones antony

:octocat:
Loving SvelteJS
View GitHub Profile
@antony
antony / Xephyr.groovy
Created November 30, 2011 10:43
Running functional tests with Xephyr
includeTargets << grailsScript("_GrailsInit")
display = ':65'
resolution = '-screen 1024x768'
target('default': "Run tests with xephyr") {
List parsedArgs = args.split() as List
exec (executable: 'Xephyr', spawn: true) {
@antony
antony / grails-geb
Created February 14, 2012 11:54
A properly configured BuildConfig.groovy for running Geb under Grails 2.0
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.dependency.resolution = {
inherits("global") {
}
log "warn"
@antony
antony / gist:2002027
Created March 8, 2012 16:50
Spock Formatting
def "The 'recommended' way"() {
when:
enabled = true
firstName = "Luke"
lastName = "Daley"
createButton.click()
then:
at ShowPage
}
@antony
antony / gist:5907972
Created July 2, 2013 09:36
Angular Select Box DSL Extension for retreiving Options.
angular.scenario.dsl('selectBox', function() {
var chain = {};
chain.option = function(value) {
return this.addFutureAction("select '" + this.name + "' option '" + value + "'", function($window, $document, done) {
var select = $document.elements('select[name="$1"]', this.name);
var option = select.find('option[value="' + value + '"]');
if (option.length) {
select.val(value);
} else {
@antony
antony / TestShard.groovy
Created July 4, 2013 13:41
Parallelise your Grails functional tests! Put this in your scripts dir.
import org.codehaus.groovy.grails.test.support.GrailsTestTypeSupport
import org.codehaus.groovy.grails.test.GrailsTestTypeResult
import org.codehaus.groovy.grails.test.event.GrailsTestEventPublisher
import org.codehaus.groovy.grails.test.GrailsTestTargetPattern
includeTargets << grailsScript("_GrailsClean")
includeTargets << grailsScript("_GrailsTest")
// grails t-s shard=1 shards=4
@antony
antony / stripe-checkout.js
Last active January 4, 2016 04:29
Faking out the Stripe CheckoutJS for Functional Tests. A simple drop-in replacement for https://checkout.stripe.com/checkout.js for your functional test environment.
var handler,
StripeHandler = new Klass({
initialize: function(token) {
this._callback = token;
},
open: function(attrs) {
var _self = this,
button = $('<button id="dummy-stripe">').html(attrs.description),
overlay = $('<div>', {id: 'dummy-stripe-overlay', style: "position: absolute; width: 20%; height: 40%; background-color: #fff; top: 30%; left: 40%; border: 4px solid #000; display: block; margin: auto auto;"}).html(button);
$('body').append(overlay);
### Keybase proof
I hereby claim:
* I am antony on github.
* I am aiten (https://keybase.io/aiten) on keybase.
* I have a public key whose fingerprint is 17B8 82E3 9AE7 A87E 11FE 4F78 DEEF 31AE A794 9547
To claim this, I am signing this object:
@antony
antony / gist:282033be1dae877fea45
Created October 10, 2014 15:59
Create a Jenkins view filter.
<!--
You need to install the 'anything-goes' plugin and enable it, first:
https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=60915753
Then click 'edit description' on your view, and just paste this whole file into it and click save.
Done. Type to filter.
-->
<input class="search" placeholder="Type to filter..." style="font-size: 24px; padding: 10px; height: 50px; width: 100%;" autofocus />
<script>
!function(){function a(b,c,d){var e=a.resolve(b);if(null==e){d=d||b,c=c||"root";var f=new Error('Failed to require "'+d+'" from "'+c+'"');throw f.path=d,f.parent=c,f.require=!0,f}var g=a.modules[e];if(!g._resolving&&!g.exports){var h={};h.exports={},h.client=h.component=!0,g._resolving=!0,g.call(this,h.exports,a.relative(e),h),delete g._resolving,g.exports=h.exports}return g.exports}a.modules={},a.aliases={},a.resolve=function(b){"/"===b.charAt(0)&&(b=b.slice(1));for(var c=[b,b+".js",b+".json",b+"/index.js",b+"/index.json"],d=0;d<c.length;d++){var b=c[d];if(a.modules.hasOwnProperty(b))return b;if(a.aliases.h

Modelling Family, Friends, Enemies, Pets and Deaths in the Wizarding World

Setup

@antony
antony / AngularJsAware.groovy
Last active February 11, 2020 15:12
Make Geb work with AngularJS reliably, by waiting for the angular views to be resolved before attempting assertions. This uses the same onReady technique as Protractor.
package extensions
trait AngularJsAware {
boolean isAngularReady() {
js.exec('window.MYAPP.waitForAngular();');
waitFor {
js.MYAPP.APP_READY == true
}