Skip to content

Instantly share code, notes, and snippets.

View lindesvard's full-sized avatar

Carl-Gerhard Lindesvärd lindesvard

  • Stockholm, Sweden
View GitHub Profile
@lindesvard
lindesvard / createApolloClient.js
Created June 13, 2018 11:09
ApolloClient with JWT auth and refetch jwt token with refreshtoken
import config from 'config'
import { getAccessToken } from 'libs/storage'
import { ApolloClient } from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { InMemoryCache } from 'apollo-cache-inmemory'
import customFetch from './customFetch'
const httpLink = createHttpLink({
uri: config.GRAPHQL_URL,
@lindesvard
lindesvard / resize-image.js
Created March 26, 2018 13:16
Resize image with Jimp
var Jimp = require("jimp");
var url =
"http://cdn.wonderfulengineering.com/wp-content/uploads/2016/01/Desktop-Wallpaper-2.jpg";
const saveAndResize = (image, name, width, height, extension) => {
image
.clone()
.cover(width, height)
.quality(50)