Skip to content

Instantly share code, notes, and snippets.

View abachuk's full-sized avatar
✍️
dev manager by day, writing code at night

Alex Bachuk abachuk

✍️
dev manager by day, writing code at night
View GitHub Profile
// modules.js
export function drive(props) {
return props.gas
}
export function fly(props) {
return props.miles
}
// main.js
// after all babel and webpack configs
import AWS from 'aws-sdk';
import { CognitoUserPool } from 'amazon-cognito-identity-js';
export default function signupHandler(body) {
const userData = JSON.parse(body);
AWS.config.region = 'us-east-1';
const poolData = {
import AWS from 'aws-sdk';
import { CognitoUserPool, AuthenticationDetails, CognitoUser } from 'amazon-cognito-identity-js';
export default function signinHandler(body) {
const authData = JSON.parse(body);
AWS.config.region = 'us-east-1';
const authenticationDetails = {
Username: authData.username,
Password: authData.password,
};
const fruits = {
apples: 3,
bananas: 4,
pears: 1,
blackberries: 8
}
// always check if Storage is available
if (typeof(Storage)) {
// saving the object (or JSON) to localStorage
// let's define our expiration date
const today = new Date();
let expDate = new Date();
expDate.setDate(today.getDate() + 30); // 30 days expiration
// a searches user does in your app on the first visit, we collect them to save to localStorage
const userRecentlocations = [
{ city: "New York", country: "US", id: "2390230" },
{ city: "Athens", country: "GR", id: "304802" },
{ city: "Kyiv", country: "UA", id: "1239488" }