Skip to content

Instantly share code, notes, and snippets.

@BishopKO
BishopKO / Django-ReactJS config
Created July 1, 2020 19:49
Basic ReactJS and Django config
npm i -D @babel/core babel-loader @babel/preset-env @babel/preset-react babel-plugin-transform-class-properties
npm i react react-dom
npm i webpack webpack-cli
.babelrc:
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["transform-class-properties"]
}
### config.js ###
import { configure, addDecorator } from '@storybook/react';
import themeDecorator from './themeDecorator';
addDecorator(themeDecorator);
const loaderFn = () => {
const req = require.context('../src/components', true, /\.stories\.js$/);
req.keys().forEach(fname => req(fname));
};
import pytube
import clipboard
import time
import sys
class DownTube:
def __init__ (self, mode="listen"):
mode = sys.argv[1][1:]
if mode=="listen":
@BishopKO
BishopKO / ESP_ESSP8266WiFi_Server_AJAX_response
Last active February 6, 2021 19:57
ESP_ESP8266WiFi_Server_AJAX_response
void sendAJAXresponse(WiFiClient client, String message){
String content_length_header = "Content-Length:"+String(message.length())+"\r\n";
String answer = message + "\r\n";
client.write("HTTP/1.1 200 OK\r\n");
client.write("Content-Type:text/plain\r\n");
client.write("Access-Control-Allow-Origin:*\r\n");
client.write("Access-Control-Max-Age:600\r\n");
client.write("Access-Control-Allow-Methods:PUT,POST,GET,OPTIONS\r\n");
client.write("Access-Control-Allow-Headers:*\r\n");
@BishopKO
BishopKO / Simple Translator
Last active July 11, 2021 12:22
Simple online english-polish translator with automatic clipboard check
import requests
import re
from win10toast import ToastNotifier
import pyperclip
import time
def get_translation(word):
url = f'https://pl.pons.com/t%C5%82umaczenie/angielski-polski/{word}'
try: