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 / index.html
Last active October 24, 2020 22:33
Svelte App on Older Browsers (IE11+)
<!-- generated via npm run build && npx create-polyfill-service-url analyse --file public/bundle.js -->
<script crossorigin="anonymous" src="https://cdn.polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.map,ArrayBuffer,console,DataView,Date.prototype.toISOString,document,fetch,Function.prototype.bind,globalThis,Map,Object.create,Object.defineProperties,Object.defineProperty,Object.entries,Object.getOwnPropertyDescriptor,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.getPrototypeOf,Object.keys,Object.setPrototypeOf,Promise,Reflect,Reflect.construct,Set,Symbol,Symbol.iterator,WeakMap,WeakSet"></script>
@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
}
@antony
antony / rollup.config.js
Last active September 15, 2019 07:02
Configuration variables in Svelte / Sapper
import conf from 'config'
const appConfig = Object.keys(conf).reduce((acc, n) => {
acc[`process.env.${n}`] = JSON.stringify(conf[n])
return acc
}, {})
export default {
client: {
...,
@antony
antony / SomeComponent.svelte
Last active August 15, 2019 15:07
Getting config from node-config into Sapper as `process.env.variableName`
<h1>
{process.env.myConfigVariable}
</h1>
@antony
antony / ExamplePage.groovy
Created September 20, 2015 11:10
Testing asynchronously inserted content (such as modals) with Geb. Thanks to Verity.
// We use 'to:' on the modal trigger to force a refresh of the page cache once the modal has been inserted.
// Angular Bootstrap modals are actually created in the DOM once they are triggered, so our initial page parse doesn't grab them.
// If we don't do this, you will end up with a lot of nulls since Geb 0.11.
class ExamplePage extends Page {
static content = {
modalTrigger(to: ExamplePage) { $('.show-modal') }
modal { $('.my-modal').module(ModalDialogModule) }
}
@antony
antony / api.js
Created December 10, 2018 12:04
Universal Api Client for Sapper
import querystring from 'querystring'
import fetch from 'node-fetch'
const base = `${process.env.apiUrl}/api/v1`
class HttpError extends Error {
}
class AccessDeniedError extends HttpError {
}
@antony
antony / BrowserLoggingBaseSpec.groovy
Created October 24, 2016 10:15
Get JavaScript console errors in Geb
package myapp.specs.base
import geb.spock.GebReportingSpec
import spock.lang.Shared
import static org.openqa.selenium.logging.LogType.BROWSER
abstract class BrowserLoggingBaseSpec extends GebReportingSpec {
void cleanup() {
04fa8427a6bd1febc6863fa38e2dd82a1dc6c26860ba43eaf095629f68f55e452a625e8e14dddb4626d0b0f180f0024a7d460cdce5dda44f8684ce33e016ebf5c8;wayne-o
@antony
antony / gist:11b028fc1ff39f63be64824f9642eac8
Created February 11, 2018 21:20
Seed hapijs v17 application.
'use strict'
const Hapi = require('hapi')
const server = Hapi.server({ port: 3000, host: 'localhost' })
const init = async () => {
await server.start()
console.log(`Server running at: ${server.info.uri}`)
}

Keybase proof

I hereby claim:

  • I am antony on github.
  • I am aiten (https://keybase.io/aiten) on keybase.
  • I have a public key ASCn6d0qJgOXOuqmRnQSHTAYoj2U_pdHzKHZS2mUT9fAcwo

To claim this, I am signing this object: