Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View michelts's full-sized avatar

Michel Sabchuk michelts

View GitHub Profile
import lxml
import requests
url = "https://www3.bcb.gov.br/sgspub/consultarvalores/consultarValoresSeries.do?method=consultarValores"
payload = {
"optSelecionaSerie": "7460",
"dataInicio": "31/01/1994",
"dataFim": "01/12/2021",
"selTipoArqDownload": "1",
"chkPaginar": "on",
const FolderTree = ({folders}) => (
<ul>
{folders.map(folder => (
<Item key={folder.name} folder={folder} />
))}
</ul>
);
const Item = ({folder}) => {
const [isOpen, setIsOpen] = useState(false);
<li key={folder.name}>
{folder.name}
+ {folder.contents?.length && (
+ <FolderTree folders={folder.contents} />
+ )}
</li>
const FolderTree = ({folders}) => (
<ul>
{folders.map(folder => (
<li key={folder.name}>
{folder.name}
</li>
))}
</ul>
);
describe('FolderTree component', () => {
it('should allow select deeply nested folders', () => {
render(<FolderTree folders={sampleData} />);
openFolder('/home');
openFolder('/home/michel');
selectFolder('/home/michel');
expect(folderIsSelected('/home/michel')).toBeTruthy();
});
});
@michelts
michelts / sample.html
Last active October 10, 2021 13:28
HTML code for tree-structured data
<ul>
<li><button type="button">-</button> /home <button type="button">select</button>
<ul>
<li><button type="button">-</button> /home/michel <button type="button">select</button>
<ul>
<li><button type="button">+</button> /home/michel/Documents <button type="button" disabled="">selected</button></li>
<li><button type="button">+</button> /home/michel/Pictures <button type="button">select</button></li>
</ul>
</li>
</ul>
@michelts
michelts / data.json
Last active October 10, 2021 13:28
Sample tree-structured data
[
{"type":"directory","name":"usr","contents":[
{"type":"directory","name":"bin","mode":"0755","prot":"drwxr-xr-x","contents":[
{"type":"link","name":"X11","target":".","mode":"0777","prot":"lrwxrwxrwx","contents":[]}
]},
{"type":"directory","name":"games","mode":"0755","prot":"drwxr-xr-x","contents":[
]},
...
]
FROM python:alpine
RUN pip3 install Django
const [global, useGlobal] = useGlobal();
useGlobal.mockReturnValueOnce([mockedGlobal, mockedUseGlobal]);
const reducerFunc = useGlobal('someReducerFunc');
useGlobal.mockReturnValueOnce(mockedReducerFunc);
const [global, setGlobal] = useGlobal();
useGlobal.mockReturnValueOnce([mockedGlobal, jest.fn()]);
const reducerFunc = useGlobal('someReducerFunc');
useGlobal.mockReturnValueOnce(mockedReducerFunc);