Skip to content

Instantly share code, notes, and snippets.

View blitzblade's full-sized avatar
🎯
Focused.

Kwesi Dadson blitzblade

🎯
Focused.
View GitHub Profile
@blitzblade
blitzblade / lecture 1.md
Created September 5, 2023 21:33
STS backend-lavender

What's software engineering at all?

  • chief scribe: the make up of everything intangible on our devices.

What's backend?

  • Backend is the code that's stored on a computer somewhere that processes what

What's the terminal?

@blitzblade
blitzblade / lecture 1.md
Last active July 11, 2023 21:23
ST backend lectures

Commands

ls - for listing touch - for creating files cd - for changing directory cd .. cd ../../.. mkdir - for creating folder pwd - for telling where we currently are cp - for copying files

@blitzblade
blitzblade / grading.py
Created November 17, 2022 22:14
gradingsystem.py
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:
@blitzblade
blitzblade / a_to_i.py
Created October 30, 2022 15:10
#leetcode
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
@blitzblade
blitzblade / bullet-train.md
Created July 4, 2022 11:29
BulletTrain Rails Framework

Basic commands and tips for bullettrain.io

Scaffold views and controller for a model User with an association to Team

bin/super-scaffold crud User Team current_team_id:text_field{class_name=Team}
### ... 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("?")){
@blitzblade
blitzblade / index.js
Last active May 23, 2022 10:55
#medium
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(
@blitzblade
blitzblade / App.js
Last active May 22, 2022 21:09
#medium
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