Skip to content

Instantly share code, notes, and snippets.

sofyan-ahmad / aws-amplify-react-native.d.ts
Last active Jul 20, 2020
aws amplify react native typescript definition
View aws-amplify-react-native.d.ts
declare module 'aws-amplify-react-native' {
const Amplify: any;
export default Amplify;
// *** UI ***
interface ITheme {
container: {};
section: {};
sectionHeader: {};
sectionHeaderText: {};
View googleSheet.service.ts
import {HttpException, Injectable} from '@nestjs/common';
import {google} from 'googleapis';
import {GoogleApiService} from '../googleApi/googleApi.service';
export class GoogleSheetService {
constructor(private readonly googleApiService: GoogleApiService) {}
async readSheet(): Promise<any[]> {
View googleApi.controller.ts
import {Body, Controller, Get, Post, Render} from '@nestjs/common';
import {GoogleApiService} from './googleApi.service';
export class GoogleApiController {
constructor(private readonly service: GoogleApiService) {}
View googleApi.service.ts
import {HttpException, Injectable} from '@nestjs/common';
import {Credentials, OAuth2Client} from 'google-auth-library';
import {google} from 'googleapis';
import _ from 'lodash';
import fs from 'fs';
import util from 'util';
import credentialsJson from '../../../credentials.json';
import {IGoogleToken} from './googleToken.interface';
sofyan-ahmad / authStorage.ts
Last active Apr 30, 2020
AWS Amplify Custom Asyncstorage
View authStorage.ts
import {Auth} from 'aws-amplify';
import AsyncStorage from '@react-native-community/async-storage';
import {ICognitoStorage} from 'amazon-cognito-identity-js';
const MEMORY_KEY_PREFIX = '@fcAuth:';
let dataMemory = {};
const syncPromise: Promise<any> = null;
* This is used to set a specific item in storage
View apiClient.ts
import axios from 'axios';
export const getSignedURL = async (
url: string,
file: File
): Promise<{ fileName: string; s3Url: string }> => {
try {
const endpoint = url;
const payload = {
View uploadViews.vue
<el-button @click="uploadImage">Upload</el-button>
View uploadZone.vue
<div class="upload-container">
View upload.controller.ts
import { Body, Controller, HttpException, Post } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { ApiTags } from '@nestjs/swagger';
import AWS from 'aws-sdk';
import { v4 as uuid } from 'uuid';
import { IFileSignedUrl } from './fileSignedUrl.interface';
const s3 = new AWS.S3({ useAccelerateEndpoint: true });
sofyan-ahmad / SignUpBottomSheet.tsx
Created Apr 5, 2020
Animated React Native Sign Up Bottom Sheet
View SignUpBottomSheet.tsx
import {NavigationProp} from '@react-navigation/native';
import {Button, Text} from '@ui-kitten/components';
import React, {useEffect, useState} from 'react';
import {StyleSheet, View} from 'react-native';
import BottomSheet from 'reanimated-bottom-sheet';
export interface ISignUpSheet {
isOpen: boolean;
navigation?: NavigationProp<any, any>;
onClose: (...args: any) => void;
You can’t perform that action at this time.