This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| N = 8 | |
| data = [] | |
| with open("data.csv") as f: | |
| table = csv.reader(f) | |
| next(table) | |
| for row in table: | |
| data.append(list(map(int, row))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Node: | |
| def __init__(self, data): | |
| self.data = data | |
| self.next = None | |
| class List: | |
| def __init__(self): | |
| self.head = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Dict | |
| from pprint import pprint | |
| def parse_dataset(filename: str) -> Dict[str, str]: | |
| data = {} | |
| with open(filename) as f: | |
| for line in f: | |
| line = line.rstrip() | |
| if line.startswith(">"): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>DJ Book Search</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css" /> | |
| <link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.css" /> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.views import View | |
| from django.http import JsonResponse | |
| from django.views.generic import TemplateView | |
| from book.search import search | |
| class IndexView(TemplateView): | |
| template_name = 'index.html' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Dict, List, Union | |
| from django.conf import settings | |
| from requests import get | |
| from urllib.parse import urlencode | |
| BASE_URL = 'https://www.googleapis.com/books/v1/volumes' | |
| DEFAULT_THUMBNAIL = {'thumbnail': 'https://bit.ly/2NG0A8J'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.dispatch import receiver | |
| from django.db.models.signals import post_save | |
| from rest_framework.authtoken.models import Token | |
| @receiver(post_save, sender=settings.AUTH_USER_MODEL) | |
| def create_auth_token(sender, instance=None, created=False, **kwargs): | |
| if created: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { useUsername } from "../store/auth/hooks"; | |
| function Account() { | |
| const username = useUsername(); | |
| return <h2>Welcome, {username}</h2>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface TokenResponse { | |
| token: string; | |
| } | |
| export interface Credentials { | |
| username: string; | |
| password: string; | |
| } | |
| const BASE_URL = "http://localhost:8000"; |