Skip to content

Instantly share code, notes, and snippets.

:octocat:
Loving SvelteJS

Antony Jones antony

:octocat:
Loving SvelteJS
Block or report user

Report or block antony

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Blob to Data Url
From: https://stackoverflow.com/questions/23150333/html5-javascript-dataurl-to-blob-blob-to-dataurl
//**dataURL to blob**
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], {type:mime});
@antony
antony / api.js
Created Dec 10, 2018
Universal Api Client for Sapper
View api.js
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 / process.env.robotsTxt
Created Oct 22, 2018
Simple robots.txt generation for Sapper
View process.env.robotsTxt
{
UserAgent: '*',
Disallow: '/'
}
View genesis_public_key
04fa8427a6bd1febc6863fa38e2dd82a1dc6c26860ba43eaf095629f68f55e452a625e8e14dddb4626d0b0f180f0024a7d460cdce5dda44f8684ce33e016ebf5c8;wayne-o
View gist:11b028fc1ff39f63be64824f9642eac8
'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}`)
}
View keybase.md

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:

@antony
antony / BrowserLoggingBaseSpec.groovy
Created Oct 24, 2016
Get JavaScript console errors in Geb
View BrowserLoggingBaseSpec.groovy
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() {
@antony
antony / Chance.groovy
Last active Aug 31, 2016
ChanceJS from Groovy / Java
View Chance.groovy
package vendigo.support.extensions
import groovy.json.JsonOutput
import javax.script.ScriptEngine
import javax.script.ScriptEngineManager
class Chance {
private static ScriptEngine engine
@antony
antony / example.js
Last active Jun 9, 2016
Dynamic Selenium Page Model example in NodeJS / JavaScript
View example.js
'use strict'
class MagicPage {
constructor () {
var contents = Object.keys(this.getContent())
contents.map((key) => {
this[key] = this.getContent()[key]
})
}
}
@antony
antony / ShiroAwareSpecification.groovy
Created Nov 30, 2015
Unit Testing Shiro Subjects with Spock
View ShiroAwareSpecification.groovy
class ShiroAwareSpecification extends Specification {
@Shared Subject subject
@Shared ThreadState threadState
void setupSpec() {
subject = Mock(Subject)
threadState = new SubjectThreadState(subject)
threadState.bind()
}
You can’t perform that action at this time.