- chief scribe: the make up of everything intangible on our devices.
- Backend is the code that's stored on a computer somewhere that processes what
| def gradingStudents(grades): | |
| # Write your code here | |
| def roundd(grade): | |
| if grade >= 38: | |
| int_part = grade // 10 #64/10 | |
| remainder = grade % 10 | |
| if remainder >= 8: | |
| return int_part*10 + 10 | |
| elif 5 >= remainder >= 3: |
| class Solution: | |
| def myAtoi(self, s: str) -> int: | |
| s = s.strip() | |
| if not s: | |
| return 0 | |
| sign = 1 | |
| if s[0] == "-" or s[0] == "+": |
| class Solution: | |
| def minRemoveToMakeValid(self, s: str) -> str: | |
| #input: aart(bb)))cd((b) | |
| #output: aart(bb)cd(b) | |
| #1. find an open bracket. If none, empty | |
| #2. If I find an open bracket, increment left by 1, look for corresponding closing bracket. | |
| #3. If found, reduce left by 1, start looking for next bracket. Else, plan to remove. | |
| #4. keep track of indices of brackets to remove. | |
| #5. Remove them |
| ### ... new endpoint | |
| @app.route('/api/twitter_auth_callback', methods=["GET"]) | |
| @cross_origin() | |
| def twitter_callback(): | |
| try: | |
| oauth_token = request.args.get('oauth_token') | |
| oauth_verifier = request.args.get('oauth_verifier') | |
| auth = tweepy.OAuthHandler(consumer_key, consumer_secret) |
| import React, { useState, useEffect } from 'react'; | |
| import axios from 'axios'; | |
| function Twittercallback() { | |
| const API_URL = "http://localhost:5000" | |
| const [data, setData] = useState({}); | |
| useEffect(() => { | |
| //pick params and send api request to get final user data | |
| const path = window.location.href; | |
| if (path.includes("?")){ |
| import React from 'react'; | |
| import { BrowserRouter, Routes, Route } from "react-router-dom"; | |
| import ReactDOM from 'react-dom/client'; | |
| import './index.css'; | |
| import App from './App'; | |
| import Twittercallback from './TwitterCallback'; //new | |
| import reportWebVitals from './reportWebVitals'; | |
| const root = ReactDOM.createRoot(document.getElementById('root')); | |
| root.render( |
| import axios from 'axios'; | |
| import './App.css'; | |
| function App() { | |
| const API_URL = "http://localhost:5000" | |
| const initTwitterAuth = () => { //new | |
| axios.request({ //new | |
| method: "post", //new | |
| url: `${API_URL}/api/auth_twitter`, //new |