Skip to content

Instantly share code, notes, and snippets.

Loving SvelteJS

Antony Jones antony

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 SimpleFileUploader.svelte
{#if uploading}
<Progress bind:percent={progress} text="Uploading..." />
{:else if processing}
<Progress percent={100} text="Processing..." />
<slot name="content">
antony / rollup.config.js
Last active Sep 15, 2019
Configuration variables in Svelte / Sapper
View rollup.config.js
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 / SomeComponent.svelte
Last active Aug 15, 2019
Getting config from node-config into Sapper as `process.env.variableName`
View SomeComponent.svelte
antony / Flipper.svelte
Created Aug 10, 2019
An example of a div which can flip its content
View Flipper.svelte
<div class="card-container">
<div class="card">
{#if flipped}
<div class="side" transition:turn>
<slot name="front"></slot>
<div class="side back" transition:turn>
<slot name="back"></slot>
View Blob to Data Url
//**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);
u8arr[n] = bstr.charCodeAt(n);
return new Blob([u8arr], {type:mime});
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 / process.env.robotsTxt
Created Oct 22, 2018
Simple robots.txt generation for Sapper
View process.env.robotsTxt
UserAgent: '*',
Disallow: '/'
View genesis_public_key
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: ${}`)

Keybase proof

I hereby claim:

  • I am antony on github.
  • I am aiten ( on keybase.
  • I have a public key ASCn6d0qJgOXOuqmRnQSHTAYoj2U_pdHzKHZS2mUT9fAcwo

To claim this, I am signing this object:

You can’t perform that action at this time.