Skip to content

Instantly share code, notes, and snippets.

View alexbassy's full-sized avatar
🌈

Alex Bass alexbassy

🌈
View GitHub Profile
{
"Custom Directory" : "Advanced",
"Working Directory" : "~\/Projects\/",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Red Component" : 1,
"Color Space" : "sRGB",
"Blue Component" : 0.99999994039535522,
"Alpha Component" : 1,
"Green Component" : 0.99999994039535522
'use strict'
const https = require('https')
const path = require('path')
const API_BASE = `api.typeform.com`
const CLIENT_ID = process.env.TYPEFORM_CLIENT_ID
const CLIENT_SECRET = process.env.TYPEFORM_CLIENT_SECRET
function postRequest (host, path, body) {
'use strict'
const callback = (event, context, callback) => {
const response = {
statusCode: 200,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': true
},
body: JSON.stringify({
service: oauth
app: helpful-oauth
tenant: alexbass
provider:
name: aws
runtime: nodejs8.10
profile: serverless
@alexbassy
alexbassy / serverless-iam.json
Last active August 20, 2018 19:35
IAM policy for serverless applications
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"lambda:CreateFunction",
"s3:Get*",
"iam:CreateRole",
import React, { Component } from 'react'
import { StyleSheet, Text, View, TouchableOpacity, Linking } from 'react-native'
export default class App extends Component {
handleAuthorisationCallback = async (ev) => {
// event contains the URL to which the API will redirect the user
// in our case, it'll be typeformresponses://oauth_callback?code=XXX
}
openAuthorisationPage = async () => {
import React from 'react'
import { StyleSheet, Text, View,
TouchableOpacity, Linking, ActivityIndicator } from 'react-native'
import Api from './api'
export default class App extends React.Component {
state = {
loading: true,
loggedIn: false,
loginError: false
import url from 'url'
import qs from 'querystring'
import Config from 'react-native-config'
import { AsyncStorage } from 'react-native'
const TOKEN_NAME = 'api-token'
export class Api {
constructor ({ scopes, base, secrets, fetchMock }) {
this.fetch = fetchMock || fetch
// src/api.js
require('dotenv')
const { API_CLIENT_ID, API_CLIENT_SECRET } = process.env
const API_BASE = 'https://api.typeform.com'
class Api {
}
@alexbassy
alexbassy / example.js
Created March 8, 2018 08:28
Realm + Jest / Worker error message
// SettingsController.test.js
import { SettingsController } from '../SettingsController'
const defaultOptions = [{
name: 'Enable sunshine',
value: false
}, {
name: 'Enable moonlight',
value: true