Skip to content

Instantly share code, notes, and snippets.

View SebDeclercq's full-sized avatar

Sébastien Declercq SebDeclercq

View GitHub Profile
from typing import Sequence, Union, List
from dataclasses import dataclass, field
import random
@dataclass
class Card:
color: str
value: Union[int, str]
AVAILABLE_COLORS: Sequence[str] = field(default=('coeur', 'pique', 'trèfle', 'carreau'), repr=False)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SebDeclercq
SebDeclercq / SquareDrawer.py
Created June 3, 2019 09:05
Adapted from "Think Python" exercise 3.3
from typing import Optional
class SquareDrawer:
def __init__(self, side_size: int = 5, side_amount: int = 4) -> None:
self._check_params(side_size, side_amount)
def draw_square(
self, side_size: Optional[int] = None, side_amount: Optional[int] = None
) -> None:
self._check_params(side_size, side_amount)
self._print_square_row()
#!/usr/bin/env python3
from abc import ABC, abstractmethod
from dataclasses import dataclass
class Writer(ABC):
@abstractmethod
def write(self, text: str) -> None:
pass
from lxml import etree
xml = etree.parse('FA173049.xml')
for entity in xml.docinfo.internalDTD.entities():
print(f'{entity.name}.{entity.content}')
bonjour
réinitialiser les paramètres de connexion
clic droit sur le menu démarrer
invite d commande (admin)
dans l'invite de commande tu écris ( puis entrée à chaque fois et ne pas oublier les espaces )
netsh winsock reset
netsh winhttp reset proxy
netsh winhttp reset tracing
netsh winsock reset catalog
@SebDeclercq
SebDeclercq / test.js
Created April 18, 2019 10:50
Testing to change navbar behaviour in creative-bootstrap css/js
<script>
class NavBarCustomizer {
constructor() {
this.navbar = document.querySelector('#mainNav');
this.gray = '#212529';
this.white = '#ffffff';
}
custom() {
if (! document.querySelector('.masthead')) {
if (this.navbar.classList.contains('navbar-scrolled')) {
#!/usr/bin/env python3
from typing import Callable
class Converter:
def __init__(self, lang: str = 'en') -> None:
self.lang: str = lang
if self.lang == 'fr':
self.part: str = 'vers'
elif self.lang == 'en':
document.querySelector('form.save').addEventListener('submit', () => {
let data = FormData();
data.append('substitute', this.querySelector('input[name=substitute]'));
data.append('substituted', this.querySelector('input[name=substituted]'));
let xhr = new XmlHttpRequest();
xhr.open('POST', '{% url "favorite:save" %}');
xhr.addEventListener('load', () => {
const answer = JSON.parse(xhr.responseText);
if (xhr.status == 200) {
let status = answer.status;
@SebDeclercq
SebDeclercq / Pipfile
Last active March 1, 2019 12:40
Django Pipenv Basic Config w/ Linters
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
mypy = "*"
flake8 = "*"
ipython = "*"
django-stubs = "*"