Skip to content

Instantly share code, notes, and snippets.

View JaiParakh's full-sized avatar
🏠
Working from home

JaiParakh

🏠
Working from home
View GitHub Profile
let event = new Event(auth);
event.addEvent('Summary','Description','2020-03-16T11:00:00','2020-03-18T11:00:00');
import React, { createRef } from "react";
import { StyleSheet, Text, View, Button } from 'react-native';
import ActionSheet from "react-native-actions-sheet";
const actionSheetRef = createRef();
// This Menu component is fully customizable. Add whatever you want!!
const Menu = () => (
<View style={styles.drawerContent} >
<Text>Hello There</Text>
@JaiParakh
JaiParakh / App.js
Last active December 21, 2020 08:35
import React, { useState, useEffect } from 'react';
import { View, Text, Button, StatusBar } from 'react-native';
import auth from '@react-native-firebase/auth';
import { GoogleSignin } from '@react-native-community/google-signin';
GoogleSignin.configure({
webClientId: '',
});
const {google} = require('googleapis');
var base64 = require('js-base64').Base64;
const parse = require('node-html-parser').parse;
const cheerio = require('cheerio');
var open = require('open');
var Mailparser = require('mailparser').MailParser;
class Check{
constructor(auth){
const {google} = require('googleapis');
class Event {
//This auth object should be passed whenever a new instance of class is created in order to authenticate the requests.
constructor(auth){
this.auth = auth;
this.calendar = google.calendar({version: 'v3', auth});
}
const fs = require('fs');
const readline = require('readline');
const {google} = require('googleapis');
// If modifying these scopes, delete token.json.
const SCOPES = ['https://www.googleapis.com/auth/gmail.readonly','https://www.googleapis.com/auth/gmail.modify',
'https://www.googleapis.com/auth/gmail.compose','https://www.googleapis.com/auth/gmail.send'];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.
import sys
import json
x = {
"sum": int(sys.argv[1]) + int(sys.argv[2])
}
print(json.dumps(x))
//We will have to create a childprocess in order tocall python script.
var spawn = require("child_process").spawn;
//This process is called here.
var process = spawn('python',["./add.py",7,3] );
//We listen for 'data' event.
process.stdout.on('data', function (data) {
console.log("Sum " + JSON.parse(data.toString()).sum);
});
function getAuth(auth){
var Check = require('./Check');
var obj = new Check(auth);
obj.checkForMediumMail();
}
//getMail function retrieves the mail body and parses it for useful content.
//In our case it will parse for all the links in the mail.
getMail(msgId){
//This api call will fetch the mailbody.
this.gmail.users.messages.get({
'userId': this.me,
'id': msgId
}, (err, res) => {
if(!err){