Skip to content

Instantly share code, notes, and snippets.

View mentix02's full-sized avatar
💻
coding away

Manan mentix02

💻
coding away
View GitHub Profile
class Hex(int):
def __repr__(self) -> str:
return hex(self)
_ops = ['__add__', '__sub__', '__mul__']
def _monkey_patch_op(operation):
"""
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)))
class Node:
def __init__(self, data):
self.data = data
self.next = None
class List:
def __init__(self):
self.head = None
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(">"):
<!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>
@mentix02
mentix02 / views.py
Last active February 11, 2021 07:09
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'
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'}
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:
a {
color: blue;
}
.link {
color: blue;
cursor: pointer;
text-decoration: underline;
}
import React from "react";
import { useUsername } from "../store/auth/hooks";
function Account() {
const username = useUsername();
return <h2>Welcome, {username}</h2>;
}